nginx 重写:任何 UTF8 字符的符号 [英] nginx rewrite: the symbol for ANY UTF8 character
本文介绍了nginx 重写:任何 UTF8 字符的符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道我可以使用什么符号来引用 utf8 编码表中的任何字符以进行 nginx 重写.我试过了:
I want to know what symbol I can use to refer to any character within the utf8 encoding table for nginx rewriting. I have tried:
rewrite ^/.$ /new-location.html break;
但它似乎是."只能代表ascii字符,当我尝试http://example.com/han(一个汉字)时,它确实不行.
but it seems the "." can only stand for ascii characters, when I tried http://example.com/汉 (a Chinese character), it did not work.
这也不起作用:
rewrite ^/([x00-xff])$ /new-location.html break;
推荐答案
来自文档:
但是,必须支持 UTF-8 和 Unicode明确启用;它不是默认值.Unicode 表对应响应 Unicode 版本 6.0.0.
However, UTF-8 and Unicode support has to be explicitly enabled; it is not the default. The Unicode tables corre- spond to Unicode release 6.0.0.
所以你必须启用 utf-8 才能工作:
So you have to enable utf-8 to work :
"(*UTF8)^yourregex$"
这篇关于nginx 重写:任何 UTF8 字符的符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文