Перевожу Мегаплан с Apache+mod_php на NginX+PHP-FPM. Вот .htaccess, лежащий в корне движка:
AddDefaultCharset UTF-8
RewriteEngine on
RewriteBase /
ErrorDocument 404 /errors/404.html
FileETag MTime Size
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/javascript
ExpiresActive On
ExpiresByType image/gif A2592000
ExpiresByType image/jpeg A2592000
ExpiresByType image/png A2592000
ExpiresByType application/x-javascript A2592000
ExpiresByType application/javascript A2592000
ExpiresByType text/css A2592000
RewriteRule ^(i/|img_preview/|js/|s/|setup/|z/|run.php|favicon.ico|errors/.+|static/.*|files/.*) - [L,QSA]
RewriteRule ^attach/(.*)$ run.php?__dirb=SdfFile&__dira=&__cls=File&__act=downloadAttach&__v=.easy&url=$1 [L,QSA]
RewriteRule ^([A-Z][A-Za-z0-9]+)(/([A-Z][A-Za-z0-9]*))?/([A-Z][A-Za-z0-9]+)/?([a-z][A-Za-z0-9]*)?/?([0-9]+)?(\.[a-z][A-Za-z]+)?/?$ run.php?__dirb=$1&__dir$
RewriteRule ^(.*)$ run.php?__uri=/$1 [L,QSA]
Проблема с правилами rewrite. Вот конфиг NginX:
server {
listen 80;
server_name megaplan.server.ru;
root /data/www/megaplan/public_html;
access_log /data/www/megaplan/logs/access.log;
error_log /data/www/megaplan/logs/error.log;
rewrite_log on;
rewrite ^(i/|img_preview/|js/|s/|setup/|z/|run.php|favicon.ico|errors/.+|static/.*|files/.*) $1 last;
# rewrite ^attach/(.*)$ run.php?__dirb=SdfFile&__dira=&__cls=File&__act=downloadAttach&__v=.easy&url=$1 last;
# rewrite ^([A-Z][A-Za-z0-9]+)(/([A-Z][A-Za-z0-9]*))?/([A-Z][A-Za-z0-9]+)/?([a-z][A-Za-z0-9]*)?/?([0-9]+)?(\.[a-z][A-Za-z]+)?/?$ run.php?__dirb=$1&__dira=$3&__cls=$4&__act=$5&__oid=$6&__v=$7 last;
rewrite ^(.*)$ run.php?__uri=/$1 last;
location / {
index run.php;
}
error_page 403 /errors/403.html;
error_page 404 /errors/404.html;
error_page 500 /errors/500.html;
location ~ \.php$ {
fastcgi_pass php_test_upstream;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /public_html$fastcgi_script_name;
include /etc/nginx/include/0.fc.param.inc;
}
}
# rewrite ^(.*)$ run.php?__uri=/$1 last;
rewrite ^(i/|img_preview/|js/|s/|setup/|z/|run.php|favicon.ico|errors/.+|static/.*|files/.*) $1 last;
Вопрос: почему первым отрабатывает правило, которое в конфиге написано четвёртым. Замена last на break не помогает.