So with some help I set this up a while back. It redirects/rewrites all index files to root and no www to www. I then found out that it was redirecting all my addon domains to www.maindomain.com/addondomain. I then added some fixes to it. BUT! Now if I don't have a index in the addon domain it redirects to www.maindomain.com/addondomain again. Is this normal behavior for said code? Or is there something amiss with the code? I need this fixed because I dont want google thinking any addon domains are subdirectories of the main domain. Thanks!

I'll be back after football but your addon domains should NEVER see the .htaccess in your main account's root. It looked like you're using their subdirectories in your .htaccess though, so main domain requests WILL be affected (but only via the main domain).

Regards,

DK

PicnicTutorials
—
2013-01-12T22:25:53Z —
#4

My add on domains arnt seeing the htacces. Only my main is. The htacces is in the main domain.

dklynn
—
2013-01-12T23:16:10Z —
#5

Eric,

Halftime ... then get rid of (comment out) the RewriteCond statements with the subdomains.com regex.

Regards,

DK

PicnicTutorials
—
2013-01-12T23:20:21Z —
#6

Not really sure what you mean. The us domain code currently in there prevents it from redirecting to main/addon regardless if index file is there or not.

Well, I was in a rush last time but was concerned about the optional www with a subdomain (which could also be www of the maindomain) but rushed your answer out to you anyway. My apologies for not taking sufficient time.

Specificity:

Enforce www on maindomain.

Redirect all index.htm(l) to DocumentRoot's index.html

EricWatson said:

Thanks! so it should look like this? Am I missing anything?

`RewriteEngine on

# Send subdomains off to their own domains then forget about them hereRewriteCond %3 !^www\. [NC]RewriteCond %{HTTP_HOST} ^((www\.)?([a-z]+\.))maindomain\.com$ [NC]RewriteRule .? http://%1com{%REQUEST_URI} [R=301,L]

Yes, taking the subdomains out of the equation with the first block meant that you no longer had to deal with them; enforcing www meant you no longer had to use an external redirection to the DocumentRoot's index.html file; and you didn't need to use {THE_REQUEST} for something that a RewriteRule can do far easily (which you were already doing anyway).

Please note that only the last RewriteCond atoms can be used so the backreference to %3 was previously used to prevent the redirection from www.maindomain.com to www.com.