Hi David,
I have a question regarding .htaccess file and redirecting non-www to www and http to https.
I have a niche site so my directory setup looks as follows: -
www.example.com
www.example.com/niche_one/
www.example.com/niche_two/
This is the .htacces file in (www.example.com)
{code saved}
and then at each niche installation (www.example.com/niche_one/) I have: -
{code saved}
The redirects work for www.example.com but dont when I get to the niche sites.
Is this the right setup or should I just have one .htaccess at root level?
Thanks,
Simon
Hi Simon,
.htaccess files should always be processed hierarchically, which is why if you have sub-directories containing their own .htaccess files using RewriteRule's it is necessary to ensure that there is no conflict, for example by using
RewriteCond %{REQUEST_FILENAME} !-d
.The only thing I notice regarding your top level .htaccess is that it doesn't contain a RewriteBase entry - it should default to "/" but the first thing I would try is to add that for consistency e.g.;
RewriteEngine On
RewriteBase /
If that doesn't do the trick let me know and I'll check it out further with you...
Cheers,
David.
--
PriceTapestry.com