简体   繁体   English

Nginx URL用空格重写

[英]Nginx URL rewrite with space

I have a URL /test/space which i want to redirect it to the correct URL /test/ on nginx 我有一个URL / test / space,我想将其重定向到nginx上的正确URL / test /

I tried rewrite ^/test/%20 /test redirect; 我尝试重写^ / test /%20 / test redirect;

without results any ideas? 没有结果的任何想法?

The URL encoded characters have already been decoded by the time it gets to the rewrite statement. URL编码字符在到达rewrite语句时已经被解码。 You just need to enclose it in quotes: 您只需要将其用引号引起来即可:

rewrite "^/test/ " /test redirect; 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM