我的vhost conf中有以下正则表达式:
location ~* ^/!/[^a-zA-Z0-9] {
return 301 $scheme://$http_host;
}
但它似乎只与第一个字符匹配:
# Redirects to https://shouttag.com correctly
https://shouttag.com/!/!pink
# Does not redirect as expected
https://shouttag.com/!/p!nk
我尝试过的变化:
# Assume that $is unnecessary b/c I don't know what the end of the url may be
location ~* ^/!/[^a-zA-Z0-9]${
# Only seems to work when capturing data via group syntax ()
location ~* ^/!/[^a-zA-Z0-9]+ {
谢谢.
最佳答案
您可以尝试以下规则:
location ~ ^/!/[a-zA-Z0-9]*[^a-zA-Z0-9].*${
return 301 $scheme://$http_host;
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。