Не так давно после обновлений, не могу сказать чего именно поломались ссылки на одном сайте были вида site.ru/post.html после обновления при переходе по данным ссылкам выдает error 404, пришлось привести ссылки к виду site.ru/post/ хочется вернуться обратно как было. Подскажите, если есть решение, сам искал не нашел.
Мой конфиг NGINX site.conf
NGINX site.conffastcgi_cache_path /home/cache/club levels=1:2 keys_zone=zclub:10m inactive=30d max_size=1024m;
server {
listen 80;
server_name site.ru;
root /home/www/site.ru;
index index.php index.html;
client_max_body_size 100m;
fastcgi_read_timeout 100s;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
add_header X-Frame-Options DENY;
proxy_temp_path /home/tmp/club 1 2;
client_body_temp_path /home/bodytemp/club 1 2;
location ~* ^/wp-content/.+\.(png|jpg|jpeg)$ {
expires max;
access_log off;
log_not_found off;
sendfile on;
tcp_nopush on;
tcp_nodelay off;
add_header "Cache-Control" "no-transform";
add_header Vary Accept;
try_files $uri$webp_ext $uri =404;
}
location ~* ^.+.(manifest|appcache|html?|xml|json)$ {
expires -1;
}
location ~* ^.+.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|gif|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf|css|js|woff2|webp)$ {
expires max;
access_log off;
log_not_found off;
sendfile on;
tcp_nopush on;
tcp_nodelay off;
add_header "Cache-Control" "no-transform";
}
gzip on;
gzip_min_length 128;
gzip_http_version 1.1;
gzip_buffers 128 32k;
gzip_types
text/css
text/javascript
text/xml
text/plain
text/x-component
application/javascript
application/x-javascript
application/json
application/xml
application/rss+xml
application/atom+xml
font/truetype
font/opentype
application/vnd.ms-fontobject
image/svg+xml;
gzip_static on;
gzip_proxied expired no-cache no-store private auth;
gzip_disable "msie6";
gzip_vary on;
gzip_comp_level 1;
set $skip_cache 0;
set $var_desktop "fullversion";
set $var_mobile "mobileversion";
if ($request_method = POST) {
set $skip_cache 1;
}
if ($query_string != "") {
set $skip_cache 1;
}
if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|wp-.*.php|index.php|/feed/|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") {
set $skip_cache 1;
}
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in") {
set $skip_cache 1;
}
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
fastcgi_index index.php;
fastcgi_pass unix:/run/php/php7.1-fpm.sock;
include fastcgi_params;
fastcgi_intercept_errors on;
fastcgi_cache_bypass $skip_cache;
fastcgi_no_cache $skip_cache;
fastcgi_cache zclub;
fastcgi_cache_valid 200 302 301 30d;
fastcgi_cache_valid 404 30s;
fastcgi_buffers 8 256k;
fastcgi_buffer_size 128k;
fastcgi_keep_conn on;
fastcgi_cache_lock on;
fastcgi_cache_lock_timeout 3s;
fastcgi_hide_header "X-Powered-By";
}
location ~ \.(aspx|php|jsp|cgi)$ {
return 404;
}
location ~* /(?:uploads|files)/.*\.php$ {
deny all;
}
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
rewrite ^([^.\?]*[^/])$ $1/ permanent;
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location = /sitemap_index.xml {
allow all;
log_not_found off;
access_log off;
}
location ~ /\. {
deny all;
}
location ~* \.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(\..*|Entries.*|Repository|Root|Tag|Template)$|\.php_
{
return 444;
}
location ~* \.(pl|cgi|py|sh|lua)\$ {
return 444;
}
location ~* (roundcube|webdav|smtp|http\:|soap|w00tw00t) {
return 444;
}
location ~ /(\.|wp-config\.php|readme\.html|license\.txt) { deny all; }
location ^wp-includes/(.*).php {
deny all;
}
location ^/wp-admin/includes(.*)$ {
deny all;
}
location ~ wp-config.php {
deny all;
}
if ( $http_user_agent ~* (nmap|nikto|wikto|sf|sqlmap|bsqlbf|w3af|acunetix|havij|appscan|MJ12bot|AhrefsBot|BLEXBot|bingbot|SemrushBot|musobot|ltx71|SentiBot) ) {
return 403;
}
if ($args ~* "(eval|duplicate|base64|substring|preg_replace|create_function)") {
return 403;
}
}
wp v 4.7.5
nginx version: nginx/1.13.1
PHP v 7.1.5
MysQL v 5.7.18
PS: Проблему решил. Нашел решение здесь на тостере
if (!-e $request_filename ) { rewrite ^(.*)$ /index.php?q=$1; }
Если у кого-то есть другие варианты, поделитесь пожалуйста .