[英]Redirecting “url a” to “url b” without changing “url a” in the browser
我重定向vfd.com/blog
在一个WordPress站点fufu.com/vfd
。
我所做的是像这样配置nginx(vfd.com):
location = /blog {
return 301 http://fufu.com/vfd;
}
然后我想重写fufu.com/vfd
),以便浏览器显示vfd.com/blog
:
RewriteEngine On
...
RewriteRule /vfd http://vfd.com/blog
当我通过运行vfd.com/blog
进行测试时,它仍然指向fufu.com/vfd
。
我在这里想保留http://vfd.com/blog
吗? 还是有其他选择
更新1
我试图像这样设置代理:
location = /blog {
proxy_redirect off;
proxy_set_header Host fufu.com;
proxy_redirect http://fufu.com/vfd http://vfd.com/blog;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
我现在得到的是404。检查日志说它找不到“ / blog”。 如果将fufu.com/vfd中的内容提供给vfd.com/blog,为什么仍需要“ / blog”? 我在这里还想念什么?
哇 解决了。 配置应为:
location /blog {
proxy_pass http://fufu.com/vfd;
proxy_set_header Host fufu.com;
proxy_redirect http://fufu.com/vfd http://vfd.com/blog;
}
apache的.htaccess
无关紧要。 现在的问题是vfd.com/blog
的内容仍指向fufu.com/vfd
。 将对此进行进一步调查。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.