Redirecting mysite.com/somepage/thispage.php to www.mysite.com/somepage/thispage.php
I tried doing this
RewriteEngine On
rewritecond %{http_host} ^mysite.com
rewriteRule ^(.*) http://www.mysite.com/$1 [R=301,L]
but when i go to mysite.com, it took me to http://www.mysite.com/mysite. So I removed the $1 and that se开发者_开发知识库emed to fix the issue.
But now that when I go to mysite.com/somepage/thispage.php, it does not work and shows the page not found (the www.mysite.com actually points to where the site is hosted, thats why I want mysite.com to go to www.mysite.com). How can I redirect that to mysite.com/somepage/thispage.php and also the other anything appended to mysite.com?
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
Redirects all non-www url's to www.
精彩评论