我有一些问题,重写规则apache到nginx。 在.httaccess是:Nginx的重写:检查文件访问如果不是图像
RewriteCond %{REQUEST_URI} ^/images/.* [NC]
RewriteCond %{REQUEST_URI} !^/images/.*\.(png|jpg|gif|jpeg|bmp)$ [NC]
RewriteRule ^(images/.*\.[a-zA-Z]{3,4})$ /getFile?file=$1 [NC]
我的nginx的重写不工作:
location /images/(.*) {
if ($uri !~ ^/\.(png|jpg|gif|jpeg|bmp)$) {
rewrite ^(images/(.*)\.([a-zA-Z]))$ /getFile?file=$1;
}
}
只为你我资讯:https://www.nginx.com/resources/wiki/start/topics/depth/ifisevil/ –