我有一个 olddomain.com 需要指向 newdomain.com
所以如果有人试图输入 oldomain.com/whatever 他们会进入 newdomain.com
我不想准确地映射旧的 url,所以我已经尝试过
RewriteEngine On
Redirect 301 / http://www.newdomain.com
但如果我尝试使用它效果不佳
oldomain.com/whatever
网址出现在浏览器中:
newdomain.comwhatever
(没有/)
最佳答案
这应该有效:
RewriteEngine On
RewriteRule ^(.*)$ http://newdomain.com/$1 [R=301,NC]
关于.htaccess - Htaccess : redirect from old domain to new,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29747641/