How to Fix WordPress 404 Error

Table of Contents

Have you ever encountered WordPress 404 error, which prevents your pages from displaying properly? This problem is actually easy to fix, as long as you pay attention to the rewrite settings of your web server. In this video, I will show you how to fix 404 error by using the permalink feature in WordPress dashboard, and the configuration files of Apache or Nginx. No matter which web server you use, you can follow my steps and make your website work again. Check it out!

Most servers have rewrite enabled by default, so you can start by adjusting the configuration

  1. Go to WP Backend
  2. Settings > Persistent Links Make any changes to tap save to let him recapture the configuration

Apache requires .htaccess

  1. Check if .htaccess exists
  2. Check if you can write to .htaccess
  3. Verify if Apache mod_rewrite is correctly enabled

Base .htaccess

# 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

Nginx configuration for WordPress

location / {
try_files $uri $uri/ /index.php?$args; 

If WordPress is installed in a sub-directory, such as 'blog,' you need to adjust it like this

location /blog/ {
try_files $uri $uri/ /blog/index.php?$args; 

Restart or reload Nginx:

systemctl reload nginx