Home
/
Website Help
/
Stats and Errors
/
How to Fix the HTTP Error '404 - Not Found' in WordPress

How to Fix the HTTP Error '404 - Not Found' in WordPress

Error 404 usually appears when the browser is attempting to reach a file or a page that is not there or when the .htaccess file is not properly configured. In this article we’ll focus on the most common reasons for a page to return 404 and how to fix them:

  1. Broken .htaccess on WordPress sites
  2. Missing files (when the file you’re trying to reach isn’t uploaded at all)
  3. Broken .htaccess due to SEF/SEO functionality

Broken .htaccess on WordPress sites

If your WordPress posts return 404, this is usually caused by a missing or misconfigured .htaccess file. You can easily fix this issue by regenerating your .htaccess file. To do this:

Regenerate .htaccess through Permalinks in the WordPress admin

If you have access to your WordPress admin, the easiest way to regenerate your .htaccess file is through the Permalinks page. Go to your WordPress Dashboard > Settings > Permalinks and click on Save Changes. This will regenerate your .htaccess file.

Refresh your site to check if the 404 error is still appearing.

Edit the .htaccess in File Manager

If the issue persists or if you don’t have access to your WordPress dashboard you can edit the .htaccess file in File Manager at Site Tools > Site > File Manager. Locate the .htaccess file in the website’s public_html folder and click twice to open it for editing.

Once you have opened your file, replace its content with the code below:

# 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

Save the file changes and reload the website page again.

Missing files (when you’re trying to open a file/URL that doesn’t exist) 

Your site may return 404 if you’re trying to reach a file which is not at the address you’re opening. Usually all files that are supposed to be openable and downloadable are within the public_html folder of your site. E.g. if you try to open yoursite.com/file.png and the file.png does not exist in the public_html folder, you will see a 404 page instead.

To make sure that the file you’re trying to reach is actually in its right place, review the content of the public_html folder. You can do this in your File Manager at Site Tools -> Site > File Manager. Make sure that you’re looking at the correct public_html folder – if you have a single website without any subdomains, you’ll usually have just one public_html. If you have subdomains, however, each of them will have its own folder.

If you find out that the file you’re trying to reach is not in the public_html folder, you can simply upload it using the Upload icon in the File Manager or simply drag and drop the file into it.

Broken .htaccess due to SEF/SEO functionality 

Some popular website applications like WordPress, Joomla! and Drupal often have custom settings for generating search engine friendly URLs. Very often, when custom settings are enabled, new rules are added in your .htaccess file. If your configuration is not properly set up, the new rules can cause broken or incomplete rules in the .htaccess file and as a result, 404 errors.

If you have recently enabled search engine friendly URLs (SEF) in your application and you started seeing 404 errors shortly after, review the articles below to learn how to set it up properly:

Share This Article