我有一些問題,重寫規則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/ –