Как сделать редирект с .php на / в Bitrix на Nginx?
Уже используются правила:
location / {
try_files $uri $uri/ @bitrix;
}
location ~ \.php$ {
try_files $uri @bitrix;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location @bitrix {
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root/bitrix/urlrewrite.php;
}
location ^~ /bitrix/admin/ {
try_files $uri @bitrixadm;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location @bitrixadm{
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
# fastcgi_param SCRIPT_FILENAME $document_root/bitrix/admin/404.php;
fastcgi_param SCRIPT_FILENAME $document_root/bitrix/admin/index.php;
}
Примерно такое правило:
location @rewrites {
if ($uri ~* ^/([a-z]+)$) {
set $page_to_view "/$1.php";
rewrite ^/([a-z]+)$ /$1.php last;
}
}
Но как правильно его совместить с bitrix?