I have a .htaccess file which forwards non www request to www

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mysite.com [NC]
RewriteRule ^(.*)$ http://www.mysite.com/$1 [L,R=301]

However, I have a problem if i were to put into the url mysite.com/test.php it will not forward to the www site. Any help on how i can get this fixed would be greatly appreciated. It does work if I just put mysite.com it will forward it to http://www.mysite.com. It just doesn't work when i add mysite.com/test.php

Thanks.

this wouldnt work because I have multiple websites hosted on this linux server. That would redirect all of the websites that resolve to my ipaddress

i have tried this..
its worked fine for me...

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mysite\.com [NC]
RewriteRule ^(.*)$ http://www.mysite.com/$1 [R=301,L]

That worked perfectly thank you.

This question has already been answered. Start a new discussion instead.