I've got a bit of a dillema. I'm trying to 301 redirect instances of: http://example.com http://example.com/ http://www.example.com all to http://www.example.com/ I normally use this code: RewriteCond %{HTTP_HOST} !^www.example\.com [NC] RewriteRule ^(.*) http://www.example.com/$1 [QSA,R=301,L] Code (markup): Only problem is I use subdomains on this particular site so this code don't work. Any suggestions?
Try mine its a little different: RewriteEngine On RewriteCond %{HTTP_HOST} !^(.*)\.domain\.com$ [NC] RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L] Code (markup):