Nginx 带有阿拉伯字符的重定向规则
我需要创建一个 Nginx 规则,将 /ae/ar/???%20?%20??????/
重定向到 /ae/en
。我尝试过这两条规则:
rewrite (?i)^/ae/ar/????%20?%20????(.*)$ http://$host/ae/en?永久;
重写(?i)^/ae/ar/%D8%A3%D8%B3%D8%A7%D9%81%D8%B1%20%D9%85%D9%86 %20%D8%A3%D8%AC%D9%84(.*)$ https://$host/ae/en?永久的;
但没有人工作。看起来该规则被忽略了,有任何线索可以使该规则正常工作吗?
提前致谢!
I need to create an Nginx rule that redirects /ae/ar/أسافر%20من%20أجل/
to /ae/en
. I've tried with these two rules:
rewrite (?i)^/ae/ar/أسافر%20من%20أجل(.*)$ http://$host/ae/en? permanent;
rewrite (?i)^/ae/ar/%D8%A3%D8%B3%D8%A7%D9%81%D8%B1%20%D9%85%D9%86%20%D8%A3%D8%AC%D9%84(.*)$ https://$host/ae/en? permanent;
But no one worked. Looks like the rule is ignored, any clues to make this rule work properly?
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
重写看不到编码字符的百分比。您应该能够保留阿拉伯字符(配置文件中的 UTF-8 字符),并将
%20
替换为一个空格。整个正则表达式应该用"
括起来。或者,使用
location
语句:Rewrite does not see the percent encoded characters. You should be able to leave the arabic characters as they are (UTF-8 characters within the configuration file) and replace the
%20
with a single space. The entire regular expression should be surrounded with"
s.Alternatively, use a
location
statement: