I’m trying to make non www urls to my site redirect to www urls. When I place the command below (replacing mysite.com with my actual domain of course) in the .htaccess my site cannot be accessed at all.
RewriteEngine On
RewriteCond %{HTTP_HOST} !^mysite.com$ [NC]
RewriteRule ^(.*)$ http://www.mysite.com/$1 [L,R=301]
My hosting service told me to try this one and it caused a 500 error.
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mysite.com[nc]
RewriteRule ^(.*)$ http://www.mysite.com/$1 [r=301,nc]
Any ideas on what could be causing this?