redirect整个网站

所以我redirect我的旧网站到一个新的使用这个redirect规则,我在这里find。

RewriteRule ^/(.*)$ http://www.newsite.com/ [L,R] 

问题是当用户在旧网站上input一个页面,如www.oldsite.com/something.html它跳转到www.newsite.com/something.html 。 我需要的是所有页面,不pipe是什么,redirect到http://www.newsite.com/ 。 任何想法如何我可以做到这一点?

 RewriteRule ^/(.*)$ http://www.newsite.com/ [L,R] 

是你想要的。 你描述的效果是

 RewriteRule ^/(.*)$ http://www.newsite.com/$1 [L,R] 

这不是一回事。 如果您通过某个编辑器或网站编辑configuration,可能会“解释”您认为自己想要的内容,而不是您input的内容。

 RewriteRule ^/.*$ http://www.newsite.com/? [L,R] 

“?” 将杀死任何其他查询string。

呃,从我的头顶上试试这样的事情..

编辑虚拟主机并使用

 Redirect permanent / http://www.newsite.com/ 

因此你只是把整个“旧地”重新引导到“新地”

这个想法只是重新定义oldsite.com的基础到newsite.com之前的任何其他权利?

这也可能工作

 RewriteRule ^/$ http://www.newsite.com [R=permanent,L]