WordPress website returns a 404 Page Not Found error on internal pages and posts

Started by mahesh, Feb 14, 2025, 05:28 AM

Previous topic - Next topic

mahesh

Symptoms
  • Plesk Obsidian running on Linux-based operating system
  • A WordPress website hosted on a Plesk server uses only Apache as its web server and returns returns the error HTTP 404 Page Not Found on internal pages and posts, when visited via a browser.
  • A .htaccess is missing from the main directory (Document root) of the WP installation (it may also be empty or containing incorrect information)
Cause
A Wordpress website that is hosted on an Apache web server requires the existence of a default .htaccess file within its main directory. If this file is missing or has improper content, such 404 errors are expected.

Resolution
1. Log into Plesk

2. Go to Domains > example.com > Dashboard > Files

3. Navigate to the main directory of the WP installation

4. Add the default WordPress .htaccess rewrite rules in the .htaccess file that resides within the main directory of the website:

# BEGIN WordPress

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]

# END WordPress
Once this is done, the internal pages and posts of the WP installation will be displayed properly.