On Tue, 2008-09-16 at 07:01 -0700, Drew Tomlinson wrote: > Ben Spencer wrote: > > Looks like you went the wrong direction with the rewrite. The ! is "not". > > You have "not" www.consumer-sc.ca.gov, then redirect. > > > > RewriteCond %{HTTP_HOST} !^www\.consumer-sc\.ca\.gov$ [NC] > > > > Should be > > > > RewriteCond %{HTTP_HOST} ^www\.consumer-sc\.ca\.gov$ [NC] > > > > Or even (which doesn't force the requirement of "www") > > > > RewriteCond %{HTTP_HOST} consumer-sc\.ca\.gov$ [NC] > > > > Thank you very much! That was it. > > Drew > Whilst that is absolutely correct, I think the 'correct' (nothing is ever correct) logic is that you wish all requests to be served from (eg) www.mainsite.com, rather than sub.mainsite.com or mainsite.com (or any other ServerAlias). Hence, I'd write the rule as: RewriteCond %{HTTP_HOST} !^www\.mainsite\.com$ [NC] RewriteRule ^/(.*) http://www.mainsite.com/$1 [R=301,L] Cheers Tom
Attachment:
signature.asc
Description: This is a digitally signed message part