WordPress website shows 404 Not Found on all pages except home


2016-11-16 12:47:44 UTC


2017-04-24 11:13:14 UTC


Was this article helpful?

Have more questions?

Submit a request

WordPress website shows 404 Not Found on all pages except home

Applicable to:

  • Plesk 12.5 for Linux
  • Plesk Onyx for Linux
  • Plesk 11.5 for Linux
  • Plesk 12.0 for Linux


Wordpress website shows 404 Not Found errors on all the pages except home.

Nginx proxy is used and option Process PHP through Nginx is enabled in Plesk > Domains > example.com> Web Server Settings working fine.


WordPress permalinks are using .htaccess file to rewrite page urls to http://example.com/page_name/ .

Nginx is unable to read .htaccess file, this file can be read only by Apache.

When Nginx + php-fpm is set to process PHP, Apache is not involved i the to process at all.


For few websites, create additional nginx directive for a domain in Plesk > Domains > example.com > Web Server Settings :

if (!-e $request_filename) {
rewrite ^.*$ /index.php last;

Reconfigure website using the following command:
/usr/local/psa/admin/sbin/httpdmng --reconfigure-domain example.com

If it is required to make globally on the server, create custom configuration template files:

  1. Copy default configuration templates as shown below:

    # mkdir /usr/local/psa/admin/conf/templates/custom
    # mkdir /usr/local/psa/admin/conf/templates/custom/domain
    # mkdir /usr/local/psa/admin/conf/templates/custom/domain/service
    # cp /usr/local/psa/admin/conf/templates/default/domain/nginxDomainVirtualHost.php /usr/local/psa/admin/conf/templates/custom/domain/nginxDomainVirtualHost.php
    # cp /usr/local/psa/admin/conf/templates/default/domain/service/nginxWordpressIndexing.php /usr/local/psa/admin/conf/templates/custom/domain/service/nginxWordpressIndexing.php

    Note that any changes made in default configuration templates will be lost after installation of Plesk microupdates.

  2. In file /usr/local/psa/admin/conf/templates/custom/domain/nginxDomainVirtualHost.php replace section:

    location ~ /$ {
    <?php echo $VAR->domain->physicalHosting->proxySettings['directoryIndex'] ?>

    with the following one:

    location ~ / {
    index index.php index.cgi index.pl index.html index.xhtml index.htm index.shtml;
    try_files $uri $uri/ /index.php?$args;
  3. In file /usr/local/psa/admin/conf/templates/custom/domain/service/nginxWordpressIndexing.php replace

    location ~* "^<?php echo $OPT['ssl'] ? $wordpress->httpsLocation : $wordpress->httpLocation; ?>" {


    location ~* ^/<?php echo $wordpress->location; ?> {
  4. Re-create web-server configuration files:

    # /usr/local/psa/admin/bin/httpdmng --reconfigure-all
Have more questions? Submit a request
Please sign in to leave a comment.