Last updated on May 27, 2024 by J M Mubasshir Rahman

How to fix 404 Error on WordPress

how to fix 404 error on wordpress

Have you ever been visited a website and observed a error notification that the ‘page not found’? This sometimes also happens on wordpress websites.There are several reasons that this happens.

One possible cause is that the owner of the site has taken down a page from the server, but hasn’t provided a replacement URL (a uniform resource locator, or URL, is the string of text in an address bar, like WordPress.com/2013/11/20). Another possibility is that the site’s URL is changed, but users still try to access the old address.

These glitches are more likely to occur if the maintenance of the website is subpar. For instance, a 404 error could occur as a result of the website being unavailable only temporarily for maintenance.

The good news is that this could be fixed easily! The best way to fix” pages not found” which appears on a WordPress website to make it working again.

What Is a WordPress 404 Error?

A WordPress 404 error happens when your website can’t find the page or file you’re trying to access. When this occurs, the server sends you a “404 Not Found” message.

Here are some common reasons for seeing a 404 error on a WordPress site:

  • You’ve recently moved your site to a new host.
  • You’ve changed your URL structure and haven’t set up redirects from the old URLs.
  • You don’t have the right file permissions.
  • You’ve entered an incorrect URL.
  • A poorly coded plugin or theme is causing issues.

We’ll troubleshoot everything step by step and we will show you all possible fixes for 404 Not Found error.

How Does the 404 Error Affect Your Website?

Encountering a 404 error on your site is quite usual. It can occur when visitors enter the wrong web address. However, having many of these errors, particularly on vital pages or links, can impact your site’s SEO. This could result in your website not ranking as well in search results, which could pose an issue for you.

Bad user experience: You’re trying to visit a website you enjoy, but it’s suddenly not available. How frustrating would that be, right? That’s the gist of a 404 error. It can irk visitors and reduce their trust in or time spent on your site. Moreover, if a popular page displays this error, you might miss out on potential customers.

Risk of getting punished: If your website has many errors, search engines such as Google could penalize it. This could lead to your site being ranked lower in search results, which is not good for your business.

Pages stopped indexing: If a page on your website shows a 404 error, Google won’t include it in search results. This means that if the page is crucial and you want visitors to see it, they may never find it unless you resolve the error.

Losing Visitors and Effort: When someone clicks a link to reach your website, they land on a 404 error page by mistake. Feeling frustrated, they then decide to leave, and that’s a missed opportunity for you. All your hard work to ensure your website is user-friendly seems wasted. It’s like your webpage just disappears into thin air.

How to Fix 404 Error on WordPress

Let me give you a simple guide to help you fix the 404 Not Found error on your website:

Clear Browser History & Cookies: First, clear your browser’s history and cookies. You can do this by clearing the cache and cookies in your browser settings. Another option is to try accessing your site in incognito mode to check if the error still shows up.

Adjust Permalink Settings:

If you’re seeing a WordPress 404 error on pages other than your homepage, you can fix this by adjusting your permalink settings. Here’s how you can do it:

  • Log in to your WordPress Dashboard.
  • Go to Settings → Permalinks.
  • Choose the Default settings.
  • Save the changes by clicking the button.
  • Then, revert to your previous settings (if you had a custom structure) by selecting it again.Save the settings once more.
custom structure setting

This fix might help you solve both the problem of the WordPress 404 error and the issue of “WordPress permalinks not working.”

If the solutions you’ve tried so far haven’t fixed the problem, you may need to make adjustments to the .htaccess file in your WordPress folder. This file is where you can find the main index.php file. Occasionally, 404 errors occur due to issues with this file, such as misconfigurations or permission problems.

Restore Your .htaccess File

Because .htaccess is a file that is not easily seen, you must ensure that all files are visible in your FTP client. Remember to always create a backup of your site before making any modifications.

Here’s what you need to do:

  • Sign in to your server with an FTP client:
  • Open the FTP client and link up to your server.
  • Find the .htaccess file in the main folder where you can see folders such as /wp-content/, /wp-admin/, and /wp-includes/.
  • Save the .htaccess file to your computer.
  • Go to the WordPress .htaccess support page and find the code that suits your website.
  • Copy the code you selected.
  • Open your .htaccess file and paste the code.
  • Save the changes to your .htaccess file.
  • Upload the updated file to your server, replacing the old .htaccess file.
Edit htaccess file with ftp

For example, if you have Basic WP, use 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

By doing this, you can fix problems like the WordPress 404 page not found error or issues with permalinks.

Set Up a 301 Redirect

If you’ve changed the URL of a page and haven’t set up a redirect, it’s important to redirect the old URL to the new one. This can be done using a plugin or by editing the .htaccess file.

If you prefer working with the .htaccess file, follow these steps:

Access Your .htaccess File:

  • Log in to your server using an FTP client.
  • Locate and download the .htaccess file from the root directory.

Add 301 Redirect Code:

  • Open the .htaccess file in a text editor.
  • Add the following code to the file, replacing the old and new URLs with your own:
Redirect 301 /old-page-url http://www.yourwebsite.com/new-page-url

For example:

Redirect 301 /old-blog-post http://www.yourwebsite.com/new-blog-post

If you prefer an easier method, you can use a plugin to set up a 301 redirect. Here’s how:

  1. Install the Redirection Plugin:
    • Go to your WordPress Dashboard.
    • Navigate to Plugins > Add New.
    • Search for “Redirection” and install the Redirection plugin by John Godley.
    • Activate the plugin.
  2. Configure the Redirection Plugin:
    • In your WordPress Dashboard, go to Tools > Redirection.
    • Complete the initial setup as guided by the plugin.
  3. Add a New Redirection:
    • After setup, you’ll be on the Redirection management page.
    • Click on “Add New”.
    • Enter the old URL in the “Source URL” field.
    • Enter the new URL in the “Target URL” field.
    • Click “Add Redirect” to save the changes.
Redirection Plugin Configuration

Disabling Plugins and Theme to Fix 404 Errors

An outdated or poorly coded plugin might be causing 404 errors on your WordPress site. To diagnose and fix this, you can deactivate all plugins and switch your current theme. Here’s how:

  1. Access Your WordPress Files via FTP:
    • Use an FTP client like FileZilla to connect to your server.
    • Navigate to the public_html directory.
  2. Deactivate All Plugins:
    • Go to wp-content.
    • Locate the plugins folder.
    • Rename the plugins folder to something like myplugins. This will deactivate all plugins without deleting them.
  3. Switch to a Default Theme:
    • Still in the wp-content directory, go to the themes folder.
    • Rename your active theme’s folder to something else, like mytheme.
    • WordPress will automatically switch to a default theme (such as Twenty Twenty-One) if you have it installed. If not, you may need to download and upload a default theme.
  4. Check for 404 Errors:
    • Visit your site and see if the 404 errors are resolved.
    • If the errors are gone, reactivate your plugins one by one by renaming the myplugins folder back to plugins and then renaming each plugin folder inside it until you identify the problematic one.
    • Similarly, switch back to your original theme by renaming its folder back to the original name and check if the error returns.
Disabling Plugins via ftp

Identifying the Problematic Plugin

  1. Restore the Plugins Folder:
    • Rename the myplugins folder back to plugins.
  2. Reactivate Plugins One by One:
    • Go to your WordPress Dashboard.
    • Navigate to Plugins > Installed Plugins.
    • Activate each plugin one by one.
    • After activating each plugin, check your website to see if the 404 error reappears.
  3. Identify the Problematic Plugin:
    • Continue this process until you encounter the 404 error again. The plugin you activated last is likely causing the issue.
  4. Resolve the Issue:
    • Once you’ve identified the problematic plugin, you have two options:
      • Update the Plugin: Check if there’s an update available for the plugin. Sometimes, a simple update can resolve the issue.
      • Remove the Plugin: If updating doesn’t work or there’s no update available, consider deactivating and deleting the plugin. Look for an alternative plugin that performs the same function without causing errors.
plugins dashboard

Changing and Updating the WordPress URL in the Database

If you see an error saying “The requested URL was not found on this server. If you entered the URL manually, please check your spelling and try again,” you might need to change the WordPress URL in the database. Here’s what you can do:

  • Access Your Database:
    • Log in to your hosting provider’s control panel (such as cPanel).
    • Open phpMyAdmin or any other database management tool provided.
  • Select Your WordPress Database:
    • In phpMyAdmin, select your WordPress database from the list on the left.
PHPMyAdmin
  • Locate the wp_options Table:
    • Find and click on the wp_options table. The table prefix might be different if you changed it during installation (e.g., my_prefix_options).
  • Edit the Site URL and Home URL:
    • Look for the rows with the option names siteurl and home.
    • These rows are usually near the top of the table.
  • Update the URLs:
    • Click the “Edit” button (pencil icon) next to the siteurl row.
    • In the option_value field, enter the new URL of your WordPress site (e.g., http://www.yourwebsite.com).
    • Save the changes.
    • Repeat the same steps for the home row.
  • Check Your Website:
    • After updating both URLs, visit your website to see if the issue is resolved.
Change the URL

Different versions of the 404 Not Found Error

The 404 Not Found error message can pop up in various forms, depending on your browser and server configurations. Below are a few typical versions you might come across:

  • “Page Not Found”
  • “404 Not Found”
  • “The page cannot be found”
  • “HTTP Error 404”
  • “We can’t find the page you’re looking for.”
  • “Error 404”
  • “The requested URL was not found on this server.”
  • “The requested URL /~ was not found on this server. That’s all we know.”

These messages mean the server couldn’t find the page you wanted. It’s usually due to an incorrect URL or the page being moved or deleted.

Conclusion

In wrapping up, I trust this information has assisted you in resolving the “WordPress 404 page error” or “WordPress permalinks not working” dilemma. If you’ve come across alternative solutions to tackle this issue, feel free to drop them in the comments below.

In case you’ve attempted all the strategies outlined earlier and the problem lingers, you might want to explore our WordPress error fixing services for more in-depth help and a fix.

Frequently Asked Questions

Why am I seeing a 404 error?

If you’re getting a 404 error on WordPress, it means that some pages were removed from your site without being redirected to active pages. This error can also pop up if you’ve changed the URL of a page.

How can I check for a 404 error?

To test for WordPress 404 errors, you can try tools like Deadlinkchecker. Another way is to check Google Analytics to see which pages are causing the 404 errors.

How do I fix error 404 on WordPress?

Wondering how to tackle an error 404 on your WordPress site? Here are some tips:
1. Clear your browser cache and cookies.
2. Adjust your permalinks.
3. Generate a default .htaccess file.
4. Implement a 301 redirect.
5. Temporarily deactivate plugins and themes.
6. Update the WordPress URL in the database.
7. Address the issue on local servers.

How to edit a WordPress 404 page?

Want to know how to edit a WordPress 404 page? Here’s how you can do it:
1. Go to your WordPress dashboard.
2. Click on Appearance, then select Theme Editor.
3. Look for the file called “404.php” and make the edits on your own or with the assistance of a WordPress developer.

Why is my WordPress admin showing a 404 error?

Wondering why your WordPress admin displays a 404 error? This issue can occur when file and directory permissions are set incorrectly. To fix this, make sure that directories within your WordPress setup have permissions set to 755, and files are set to 644. By doing this, you can avoid encountering 404 errors in your WordPress admin.

What is 404 detection on WordPress?

Do you know what 404 detection means on WordPress? Well, in WordPress, 404 detection is all about identifying and handling the error message that says “404 Page Not Found,” which simply means that the page you are looking for cannot be found.

How to fix the requested URL was not found on this server in WordPress?

If you encounter the error message “requested URL was not found on this server” in WordPress, you can fix it easily:
1. Go to your WordPress Dashboard.
2. Click on Settings, then select Permalinks.
3. Make sure that the .htaccess file is set to be writable so that WordPress can create the required rules automatically.

Keep Learning