Page 1 of 1

.htaccess RewriteEngine

Posted: Tue Jul 10, 2007 1:26 pm
by icesolid
I am trying to force http://mysite.com to go to http://www.mysite.com when someone tries to access my site by just typing in mysite.com.

I am using the code below to try to accomplish this but I get a "Internal Server Error". Any ideas?

RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.mysite.com$
RewriteRule ^(.*)$ http://www.mysite.com/$1

Posted: Tue Jul 10, 2007 1:31 pm
by icesolid
I have found a solution in a Google search. This is a pretty useful piece of code.

RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.your-domain.com$
RewriteRule ^(.*)$ http://www.your-domain.com/$1 [R=301]