【发布时间】:2021-10-26 05:39:43
【问题描述】:
我有这个我无法解决的问题。我有一个 nginx 服务器,我必须进行这种类型的重定向。
http://midomain.com/xxxx/xxxx/http://wikipedia.com/xx --> http://midomain.com/yyyy
因为我有两个带空格的网址,所以没有办法让它工作。
我尝试了多种方法。
rewrite ^/xxxx/xxxx/\ http://wikipedia.com/xx http://midomain.com/yyyy permanent;
rewrite "^/xxxx/xxxx/\ http://wikipedia.com/xx" http://midomain.com/yyyy permanent;
rewrite ^/xxxx/xxxx/%20http://wikipedia.com/xx http://midomain.com/yyyy permanent;
rewrite "^/xxxx/xxxx/%20http://wikipedia.com/xx" http://midomain.com/yyyy permanent;
rewrite ^/xxxx/xxxx/\ http://wikipedia.com/xx/$ http://midomain.com/yyyy permanent;
rewrite "^/xxxx/xxxx/\ http://wikipedia.com/xx/$" http://midomain.com/yyyy permanent;
rewrite ^/xxxx/xxxx/%20http://wikipedia.com/xx/$ http://midomain.com/yyyy permanent;
我不知道我是不是做错了什么。
【问题讨论】: