How to Fix 404 Error on WordPress Site: Causes and Solutions

You may have encountered the 404 error at some point. This error occurs when the server cannot find the requested resource, such as a page, post, or image. The error message usually says “404 Not Found” or “The requested URL was not found on this server”.


How to Fix 404 Error on WordPress Site: Causes and Solutions

If you have a WordPress site, you may have encountered the 404 error at some point. This error occurs when the server cannot find the requested resource, such as a page, post, or image. The error message usually says “404 Not Found” or “The requested URL was not found on this server”.

The 404 error can be frustrating for both you and your visitors, as it can affect the usability and performance of your site. It can also have a negative impact on your SEO, as it can lower your ranking and increase your bounce rate.

Fortunately, there are ways to fix the 404 error on WordPress site and prevent it from happening again. In this blog post, we will explain the common causes of the 404 error, how to troubleshoot and fix them, and how to create a custom 404 page for your site.

Common Causes of 404 Error on WordPress Site

There are many possible reasons why you may see the 404 error on your WordPress site. Some of the most common ones are:

  • Permalink issues: Permalinks are the URLs of your WordPress pages and posts. If you change your permalink structure or move or delete a page or post without redirecting the old URL, you may get a 404 error. This can also happen if your .htaccess file, which controls the rewrite rules for your permalinks, is corrupted or misconfigured.
  • Broken links: Broken links are links that point to a resource that does not exist or has been moved or renamed. They can be internal (within your site) or external (to another site). Broken links can cause 404 errors for your visitors and affect your SEO.
  • File permissions: File permissions determine who can access, read, write, or execute files on your server. If your file permissions are set incorrectly, your server may not be able to locate or serve the requested resource, resulting in a 404 error.
  • Incorrect URL: Sometimes, the 404 error can be caused by a simple typo or mistake in the URL. For example, if you misspell a word or add an extra slash or character, you may get a 404 error.
  • Poorly coded plugin or theme: A plugin or theme that is outdated or poorly coded may interfere with the functionality of your site and cause 404 errors. For example, a plugin or theme may override your permalink settings, conflict with other plugins or themes, or generate invalid URLs.

How to Fix 404 Error on WordPress Site

Depending on the cause of the 404 error, there are different solutions that you can try to fix it. Here are some of the most common ones:

Clear Browser Cache and Cookies

Sometimes, the 404 error may be caused by your browser cache and cookies, which store information about your browsing history and preferences. If your browser cache and cookies are outdated or corrupted, they may prevent you from accessing the latest version of your site.

To fix this, you can try clearing your browser cache and cookies, or visiting your site in incognito mode. This will force your browser to load a fresh copy of your site and bypass any cached data.

Update Your Permalinks

If you see the 404 error on all of your pages and posts except for your homepage, it may be due to a permalink issue. To fix this, you can try updating your permalink settings in WordPress.

To do this, follow these steps:

  • Log in to your WordPress dashboard.
  • Go to Settings → Permalinks.
  • Select the Default settings.
  • Click the Save Changes button.
  • Change the settings back to your previous configuration (the one you selected before Default).
  • Put the custom structure back if you had one.
  • Click Save Changes again.

This will update your .htaccess file with the correct rewrite rules for your permalinks and hopefully fix the 404 error.

Restore Your .htaccess File

If updating your permalinks does not work, you may need to restore your .htaccess file manually. The .htaccess file is a hidden file that controls how your server handles requests for your site. If this file is missing, corrupted, or misconfigured, it may cause 404 errors.

To restore your .htaccess file, follow these steps:

  • Connect to your server via FTP or cPanel File Manager.
  • Locate the .htaccess file in the root directory of your WordPress installation (where the main index.php file resides).
  • If you don’t see the .htaccess file, make sure that you have enabled the option to show hidden files in your FTP client or cPanel File Manager.
  • Download a backup copy of the .htaccess file to your computer.
  • Delete the .htaccess file from your server.
  • Create a new .htaccess file on your server with the following code:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
  • Save the file and upload it to your server.
  • Check your site and see if the 404 error is gone.

Set Up a 301 Redirect

If you see the 404 error on some of your pages or posts that have been moved or deleted, you can fix it by setting up a 301 redirect. A 301 redirect is a permanent redirect that tells your server and browser to send visitors to a new URL instead of the old one. This will also preserve your SEO ranking and traffic for the old URL.

To set up a 301 redirect, you can use a plugin like Redirection, which allows you to manage redirects easily from your WordPress dashboard. Alternatively, you can add the redirect code manually to your .htaccess file, using the following format:

Redirect 301 /old-url /new-url

Replace /old-url with the relative path of the old URL that is causing the 404 error, and /new-url with the relative path of the new URL that you want to redirect to. For example:

Redirect 301 /about-us /about

This will redirect visitors from https://example.com/about-us to https://example.com/about.

Disable Plugins and Themes

If none of the above solutions work, you may have a plugin or theme that is causing the 404 error. To check this, you can try disabling all your plugins and switching to a default WordPress theme.

To do this, follow these steps:

  • Log in to your WordPress dashboard.
  • Go to Plugins → Installed Plugins.
  • Deactivate all your plugins by selecting them and choosing Deactivate from the Bulk Actions dropdown menu.
  • Go to Appearance → Themes.
  • Activate one of the default WordPress themes, such as Twenty Twenty-One.
  • Check your site and see if the 404 error is gone.

If the error is gone, it means that one of your plugins or themes was causing it. To find out which one, you can reactivate them one by one and check your site after each activation. Once you find the culprit, you can either delete it, update it, or contact its developer for support.

How to Create a Custom 404 Page for Your Site

Even if you fix the 404 error on your site, there may be times when visitors encounter it due to reasons beyond your control, such as incorrect URLs or broken links from other sites. In that case, you may want to create a custom 404 page for your site that is more user-friendly and helpful than the default one.

A custom 404 page can help you retain visitors, reduce bounce rate, and improve user experience. You can use it to apologize for the inconvenience, explain why the error occurred, provide links to other relevant pages or resources, or add some humor or personality to your site.

There are different ways to create a custom 404 page for your site. One of them is using a plugin like 404page, which allows you to design and customize your own 404 page using any WordPress page builder. Another way is editing the 404.php file in your theme folder, which contains the template for your default 404 page. You can modify this file using HTML, CSS, PHP, or WordPress functions to create your own custom 404 page.

How to Monitor 404 Errors Going Forward

To prevent and fix 404 errors on your site in the future, you should monitor them regularly and take action accordingly. There are several tools that can help you track and analyze 404 errors on your site, such as:

  • Google Search Console: This is a free tool from Google that helps you optimize your site for search engines. It also provides reports on crawl errors, including 404 errors, that affect your site’s visibility and ranking. You can use Google Search Console to identify and fix broken links, submit sitemaps, request indexing, and more.
  • Redirection: This is a plugin that we mentioned earlier for setting up redirects on your site. It also has a feature that logs all 404 errors that occur on your site and shows you their source and frequency. You can use Redirection to monitor and manage 404 errors from your WordPress dashboard and create redirects for them easily.
  • Broken Link Checker: This is another plugin that helps you find and fix broken links on your site. It scans your posts, pages, comments, images, and other content for any links that don’t work and notifies you via email or dashboard. You can use Broken Link Checker to edit or remove broken links without affecting your content.

Conclusion

The 404 error is one of the most common and annoying errors that can affect your WordPress site. It occurs when the server cannot find the requested resource, such as a page, post, or image. It can have various causes, such as permalink issues, broken links, file permissions, incorrect URL, or poorly coded plugin or theme.

Fortunately, there are also various solutions that can help you fix the 404 error on WordPress site and improve your site’s usability and performance. Some of the solutions are:

  • Clearing your browser cache and cookies
  • Updating your permalinks
  • Restoring your .htaccess file
  • Setting up a 301 redirect
  • Disabling plugins and themes

You can also create a custom 404 page for your site that is more user-friendly and helpful than the default one. You can use a plugin like 404page or edit the 404.php file in your theme folder to design and customize your own 404 page.

To prevent and fix 404 errors on your site in the future, you should monitor them regularly and take action accordingly. You can use tools like Google Search Console, Redirection, or Broken Link Checker to track and analyze 404 errors on your site and create redirects for them easily.

Share:

Facebook
Twitter
Pinterest
LinkedIn

Hostinger

#1 Hosting Provider
Use code : 1FLUID35
For Extra 20% discount.

Onohosting

#1 India's Hosting Provider
Best services at Affordable price!
Starting ₹ 30 / month

Free Online SEO Tools

Explore versatile SEO tools: Meta Tag generator, PDF to JPG, QR Code Generator, IP Lookup, and much more.

Most Popular

Get The Latest Updates

Subscribe To Our Weekly Newsletter

No spam, notifications only about new products, updates.

Categories

Move Around On Site

Scroll to Top
small_c_popup.png

Learn how we helped 100 top brands gain success.

Let's have a chat