На сервере установлен nginx.
Если ввести на сайте domain.com/ru/something - сайт отдаст свою 404 страницу, если такой ссылки нет.
А если добавить .php - domain.com/ru/something.php - выбивает nginx 404. Как избавится от этого? Чтобы ошибку 404 обрабатывал сайт, а не Nginx.
Сейчас такой конфиг:
server {
server_name domain.com;
root /var/www/domain.com;
index index.php index.html;
listen 80;
listen [::]:80;
listen 443 default ssl;
ssl_certificate /etc/ssl/domain.com.crt;
ssl_certificate_key /etc/ssl/domain.com.key;
# Redirect HTTP to HTTPS
if ($scheme = http) {
return 301 https://$server_name$request_uri;
}
access_log /var/log/nginx/myopencart_access.log;
location = /sitemap.xml {
return 301 /index.php?route=extension/feed/google_sitemap;
}
location = /googlebase.xml {
return 301 /index.php?route=extension/feed/google_base;
}
location /image/data {
autoindex on;
}
location /admin {
index index.php;
}
location / {
try_files $uri @opencart;
}
location @opencart {
rewrite ^/(.+)$ /index.php?_route_=$1 last;
}
# Make sure files with the following extensions do not get loaded by nginx because nginx would display the source code, and these files can contain PASSWORDS!
location ~* \.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(\..*|Entries.*|Repository|Root|Tag|Template)$|\.php_ {
deny all;
}
# Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac).
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
location ~* \.(jpg|jpeg|png|gif|css|js|ico|json|xml|woff|woff2)$ {
expires max;
add_header Cache-Control "max-age=2592000";
access_log off;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors off;
fastcgi_buffer_size 16k;
fastcgi_buffers 4 16k;
}
}