Fix wordpress nginx permalink 404 error

Fix wordpress details page 404 page not found error on nginx server

Change below code

try_files $uri $uri/ =404;

to
try_files $uri $uri/ /wp-default/index.php?$args;

 

Here is the below working code

location /wp-default {
  # root /usr/share/;
  root /var/www/html/wp_showcase/;

  index index.php;
  #try_files $uri $uri/ =404;
  try_files $uri $uri/ /wp-default/index.php?$args;

  location ~ ^/wp-default/(doc|sql|setup)/ {
    deny all;
  }

  location ~ /wp-default/(.+\.php)$ {
    fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_nam$
    include fastcgi_params;
    include snippets/fastcgi-php.conf;
  }
}

 

 

Leave a Reply

Your email address will not be published.