Forum Moderators: phranque
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example\.com
RewriteRule ^(.*)$ http://www.example.com/$1 [R=permanent,L]
or this:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain\.com$ [NC]
RewriteRule ^(.*)$ [domain.com...] [R=301,L]
Also, what is the Options +FollowSymLinks line for? I have noticed that many people do not put that line in their redirects. What do you recommend for a simple redirect for non-www to www. Is it even a good idea to have this kind of redirect?
There are so many versions of 301's in the forums, that I narrowed it down to two that I think are good for my needs.
I just wanted to get these verified because the details are confussing and I know that one little mistake will put my site into a tail spin.
Just a little paranoid and would like some verification.
Also, I did figure out the Options +FollowSymLinks
I recently had someone link to me with the dot before the slash and since I changed the code to the second example and the search engines seem no longer to be having a problem, they follow the 301 and continue spidering.
If you add anything to your .htaccess be sure to clear your cache and check headers, you'll want to see a clean 301 redirect. The best way I found of checking is using the Firefox extension Live HTTP Headers.
(I'm still very much at the beginning learning stages, so if anyone else can jump in and correct if I'm wrong, please do.)