Mod_Rewrite, Almost Working...

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Mod_Rewrite, Almost Working...

Post 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]
Post Reply