Answer the question
In order to leave comments, you need to log in
How to redirect from .php to / to Bitrix on Nginx?
How to redirect from .php to / to Bitrix on Nginx?
The rules are already in use:
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;
}
}
Answer the question
In order to leave comments, you need to log in
No way. Because your admin panel will fall off.
But if you really want to add addresses starting with /bitrix/ to the exceptions
Bicycle:
at the top of the /bitrix/modules/main/include/prolog_before.php and /bitrix/header.php files, check $_SERVER["REQUEST_URI"] for the presence of .php, if necessary, redirect to the required address.
To prevent anything from falling off, add exceptions to addresses, in particular, starting with /bitrix/
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question