Par*_*oft 2 rewrite configuration nginx
我对 nginx 有一个奇怪的问题,它不想重写...
我有这个配置,我需要将一个哈希(40 个字符)传递给一个 php 文件,它可以与 apache mod_rewrite 一起使用,但是对于 nginx,我什至没有尝试进行简单的重写,它根本不起作用
server {
.........
location / {
rewrite ^aa$ /downloadTORRENTZ.php break;
root /usr/share/nginx/html;
index index.html index.htm;
rewrite "^([A-Z0-9]{40})$" /file.php?ddl=$1 break;
}
}
Run Code Online (Sandbox Code Playgroud)
请求通常以/
这样开始,所以你的正则表达式应该看起来像
rewrite ^/([A-Z0-9]{40})$ /file.php?ddl=$1 break;
你的哈希是 ALLCAPS 吗?也许你应该使用[a-zA-Z0-9]
40 个字符...它看起来像 sha1 哈希。可能是您应该将正则表达式简化为[0-9A-F]
归档时间: |
|
查看次数: |
4455 次 |
最近记录: |