Prevent AddOn domain from redirecting to subdomain (Bluehost)
Question
Hi my AddOn domain keeps on redirecting to a subdomain. I also noticed that this also happens when I try accessing the folder where I pointed the AddOn domain
AddOn Domain: addon.com
Subdomain: addon.maindomain.com
Subfolder: maindomain.com/addon
Why is this so? I've seen from the Domain Manager a message like this though.
Addon Parent: The domain addon.com is aliased to addon.maindomain.com
How can I prevent the redirection from happening?
Solution
Try either of these:
file: maindomain/.htaccess
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www.)?maindomain.com$ [NC]
RewriteCond %{REQUEST_URI} ^/addon/(.*)$
RewriteRule ^(.*)$ - [L,R=404]
or
file: maindomain/addon/.htaccess
writeEngine On
RewriteCond %{HTTP_HOST} ^addon.maindomain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.addon.maindomain.com$ [OR]
RewriteCond %{HTTP_HOST} ^addon.com$
RewriteCond %{REQUEST_URI} ^/$
RewriteRule ^(.*)$ http://www.addon.com/ [R=301,L]
Cheers!
Ref:
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow