Forum Moderators: phranque
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www\.example\.com [NC]
RewriteRule (.*) http://www.example.com/$1 [R=301,L] [edited by: jdMorgan at 7:40 pm (utc) on Sep. 22, 2007]
[edit reason] example.com [/edit]
So, this code should be modified slightly in either of the following ways:
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www\.example\.com
RewriteRule [b]^/(.*)$[/b] http://www.example.com/$1 [R=301,L]
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www\.example\.com
RewriteRule (.*) http://www.example.co[b]m$1[/b] [R=301,L]
If either version of the modified code does not help, and if www.example.com is not the primary ServerName (with example.com as the ServerAlias), then make sure your server is configured with UseCanonicalName off.
Jim