How to fix WordPress 404 Error htaccess

If your WordPress sites shows 404 page when accessing URLs, this is because .htaccess file is missing. WordPress uses .htaccess file to generate SEO-friendly URLs when using Apache or LiteSpeed webserver.

To fix the 404 error on WordPress, create a file with the name .htaccess and copy the following content.

If WordPress is installed on the root of your website, use the following .htaccess file

# 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

For WordPress installed on a subfolder, use

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /FOLDER/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /FOLDER/index.php [L]
</IfModule>

Back to WordPress

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *