Web Hosting Talk







View Full Version : is this mod_rewrite rule correct?


avocado
09-19-2005, 12:10 PM
Hey folks,

I want all traffic to domain.com to be redirected to www.domain.com. Is this correct?


RewriteEngine on

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


Thanks!

sasha
09-19-2005, 08:48 PM
Almost

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

avocado
09-20-2005, 09:30 AM
Oops. Thanks for the correction!