: Why can't I redirect www to non-www on my addon domain? I have a domain example.com in which I'm doing this to redirect all my traffic from www version to non-www: RewriteEngine On RewriteCond
I have a domain example.com in which I'm doing this to redirect all my traffic from www version to non-www:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.(.+)$ [NC]
RewriteRule ^(.*)$ %1/ [R=301,L]
Everything fine until now. I can do example.com to example.com, but I also have another domain which I am hosting on the same account as a addon domain. Like there is a folder like example.org in my base www directory of example.com.
Now when I'm doing example.org, I get example.com/example.org with an additional 404.
Hope you get my point. Thanks in advance.
More posts by @Murphy175
1 Comments
Sorted by latest first Latest Oldest Best
This occurs because the .htaccess will be inherited in all child directories. This is a common issue when using add-on domains because each domain shares the same path environment.
This can be resolved by any of the following:
Use more secure hosting with jailed accounts
Use a .htaccess in each add-on domain child directory
Use %{HTTP_HOST} ^www.example.com [NC] rather than %{HTTP_HOST} ^www.(.+)$ [NC]
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.