Plesk

 Website pages based on WordPress show “404 Not Found” when PHP-FPM by Apache is used

Symptoms

Cause

Rewrite rules are not adjusted to work with WordPress permalinks.

Resolution

Via WordPress admin Dashboard(preferred solution)

Save permalinks in WordPress admin dashboard:
  1. Login to Plesk.
  2. Go to Domains > example.com > WordPress > Log in
  3. Go to Settings > Permalinks
  4. Click on Save Changes

Via Plesk GUI

  1. Log into Plesk

  2. Go to Domains > example.com > File Manager > httpdocs

  3. Create the .htaccess file by clicking on it or edit existing .htaccess and add below lines:

    # BEGIN WordPress
    # The directives (lines) between "BEGIN WordPress" and "END WordPress" are
    # dynamically generated, and should only be modified via WordPress filters.
    # Any changes to the directives between these markers will be overwritten.
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteBase /
    RewriteRule ^index.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress

  4. Click Save button

Via SSH

  1. Connect to the server via SSH.

  2. Edit the file /var/www/vhosts/example.com/httpdocs/.htaccess or create it if does not exist and add below lines:

    # BEGIN WordPress
    # The directives (lines) between "BEGIN WordPress" and "END WordPress" are
    # dynamically generated, and should only be modified via WordPress filters.
    # Any changes to the directives between these markers will be overwritten.
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteBase /
    RewriteRule ^index.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress

Additional information

Website pages based on WordPress show "404 Not Found" when PHP-FPM by Nginx and Proxy Mode are used

Exit mobile version