Hello. A while back with lots of help I put together this code and added exclusion for my addon domains. These are not sub domains. But separate domains with their own folders sitting in the public_html (same as www prob). Without the exclusions all urls would redirect to the main domain. So all was/is good. But now I’m getting into the domain biz and need to host many domains. Each time I add a domain I have to go into the main sites htaccess and add it to the code for exclusion. It’s a pain. Is there anyway to rewrite this code so it automatically does it so I don’t have to enter each new domain?
So root ( / ) is were the maindomain is. And /addondomain is where the addon domains are.
301 permanent redirect index.html(htm) to folder with exclusion for addon domains
RewriteCond %{HTTP_HOST} !(addondomain\.com|addondomain\.com|addondomain\.com|addondomain\.com|addondomain\.com|addondomain\.com)
RewriteCond %{THE_REQUEST} [1]{3,9}\ /([^/]+/)index\.html?\ HTTP/
RewriteRule ^(([^/]+/))index\.html?$ http://www.maindomain.com/$1 [R=301,L]
301 permanent redirect non-www (non-canonical) to www with exclusion for addon domains
RewriteCond %{HTTP_HOST} !(addondomain\.com|addondomain\.com|addondomain\.com|addondomain\.com|addondomain\.com|addondomain\.com)
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteRule (.*) http://www.maindomain.com/$1 [R=301,L]
Thanks!
A-Z ↩︎