htaccess sitea.com/1 to siteb.com/1
i want to create with htaccess that if you go to www.website1.com/page.php that you go to w开发者_JAVA技巧ww.website2.com/page.php, and www.website1.com/foo/bar/index.php to www.website2.com/foo/bar/index.php redirects. How can i do that with htaccess? Example please.
If mod_rewrite
is available, you can put this code into the .htaccess
of www.website1.com
:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?website1\.com$
RewriteRule ^(.*)$ http://www.website2.com/$1 [L,QSA,R=301]
This would redirect every page on website1.com
to the equivalent on website2.com
精彩评论