Hi, I know this is a PHP forum, but some of the smartest coding people visit here... so hopefully you won't mind helping me with a mod_rewrite question. 🙂
To redirect visitors from example.com to WWW. example.com, I've seen 2 variations:
1.)
RewriteCond %{HTTP_HOST} example.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
2.)
RewriteCond %{HTTP_HOST} example.com
RewriteRule (.*)$ http://www.example.com/$1 [R=301,L]
The 2nd variation has an extra ^ and an extra $
I don't know what those mean, but both variations seem to work on my server -- I'm sure they are different enough that one is probably "better" than the other... Which one??
Thank you!!