Page 1 of 1

Mod_Rewrite, Almost Working...

Posted: Wed May 20, 2009 11:55 pm
by tecktalkcm0391
I want to be able to have all my domains foward the subdomain www to just the domain, so...

http://www.site1.com -> site1.com
http://www.site2.com -> site2.com

But I don't want to have to make a rule for each site.... So I thought this would work, but it is not. Any help would be great!

Code: Select all

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.*)\.com$ [NC]
RewriteRule ^(.*)$ http://%1%{REQUEST_URI}\.com [L,R=301]