.htaccess RewriteEngine

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
icesolid
Forum Regular
Posts: 502
Joined: Mon May 06, 2002 9:36 pm
Location: Buffalo, NY

.htaccess RewriteEngine

Post 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
icesolid
Forum Regular
Posts: 502
Joined: Mon May 06, 2002 9:36 pm
Location: Buffalo, NY

Post 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]
Post Reply