How to fix WordPress 404 Error “Not Found”
If you’ve stumbled upon the perplexing world of WordPress 404 errors or encountered the notorious “WordPress page not found” message, fear not! We’ve got a comprehensive solution tailored just for you.
Decoding the WordPress 404 Error
The WordPress 404 error, signaled by the HTTP response code “404 Not Found,” emerges when the server can’t locate the requested file or page. Let’s dive into the intricacies of this issue and explore common scenarios triggering this error.
Why Does the WordPress 404 Error Occur?
- Migration Woes: When migrating your site to a new host, the 404 error might make an unwelcome appearance.
- Permalink Restructuring: Changing your URL’s permalink structure without redirecting the old URL can lead to 404 errors.
- File Permission Issues: Inadequate file permissions may also contribute to the manifestation of the 404 error.
- URL Mismatch: Opening an incorrect URL or encountering poorly coded plugins/themes can result in this error.
How to Fix 404 Error on WordPress 8 Troubleshooting Solutions
1. Clear Browser History & Cookies
Start with a clean slate by clearing browser cache and cookies. Alternatively, try accessing your site in incognito mode to rule out cache-related issues.
2. Set Up Your Permalink
- Log in to your WordPress Dashboard.
- Go to Settings → Permalinks.
- Select the Default settings.
- Click the Save Changes button.
- Change the settings to the previous configuration (the one you selected before Default). Put the custom structure back if you had one.
- Click Save Settings.
Note: If you use a custom structure, copy/paste it into the Custom Base section.
This resolution has the potential to resolve the WordPress 404 error or the issue of “WordPress permalinks not Working.”
If this remedy proves ineffective, you must modify the .htaccess file located in the primary directory of your WordPress installation, where the main index.php file is situated. 404 errors often stem from incorrectly configured .htaccess files or problems related to file permissions.
Also Read : Best WordPress Backup Plugins 2024
3. Restore Your .htaccess File
Since .htaccess is a hidden file, you must set all files as visible in your FTP.
Note: It’s always recommended to backup your site before editing any files or pages.
Follow the steps below:
- Log in to your server using an FTP client.
- Download the .htaccess file which is located in the same location as folders like /wp-content/ wp-admin /wp-includes/.
- Open the downloaded file in any text editor.
- Visit the WordPress .htaccess support page and copy/paste the version of the code
- that is most suitable for your website.
- Save the .htaccess file and upload it to the live server.
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
4. Setup a 301 Redirect
If you’ve modified the URL of a particular page and haven’t set up a redirection yet, it’s necessary to redirect the old URL to the new one. You can accomplish this redirection either through a plugin or by modifying the .htaccess file.
If you’re familiar with working with .htaccess, include the following code in your .htaccess file. Remember to substitute the placeholder URLs with the actual addresses of your website.
Redirect 301 /oldpage.html https://www.mywebsite.com/newpage.html
If you prefer the easy way, you may use a plugin to set up a 301 redirect. Follow the steps below:
- Install the Redirection Plugin.
- Go to the WordPress Dashboard.
- Click Tools > Redirection.
- Complete the setup and Add new redirection.
5. Disabling Plugins/Theme
If you’re experiencing a 404 error on your WordPress site, it could be attributed to an outdated or poorly coded plugin. To investigate this, you need to deactivate all your plugins and switch to a default theme.
Please note that all WordPress themes include 404.php files, although they might not have a dedicated custom 404 error template file. If a 404 error occurs, WordPress automatically utilizes the 404.php page.
To access your WordPress files, you can use an FTP client such as FileZilla. Navigate to public_html > wp-content and rename the plugins folder to something like “myplugins.”
Now, return to your web browser to verify if the website is functioning correctly. If the error has been resolved, it indicates that one of your plugins may be responsible for the issue.
Note: If the problem persists, revert the folder name from “myplugins” to “plugins” and proceed to the next troubleshooting method.
Fixing Errors is Easier With TextraHost
Get rid of WordPress errors with a managed WordPress hosting built to deliver a hassle-free experience with incredible speeds.
If the issue has been resolved, change the folder name from “myplugins” back to “plugins” and proceed with the following steps to identify which of your plugin(s) is causing the error.
- Go to your WordPress dashboard.
- Go to Plugins > Installed Plugins.
- Activate each plugin one by one and check if your website is working.
- When you encounter the 404 error, you’d know which plugin caused it.
- Update the plugin or remove it to get rid of the error.
6. Change and Update WordPress URL in Database
You may come across the following error message on your WordPress website:
“The requested URL was not found on this server. If you entered the URL manually, please check your spelling and try again.”
Fix the error by following the steps below:
- Go to your PHPMyAdmin.
- Navigate to your database name, and select wp-option. For example, blog > wp-option.
- Change the URL, for example, from https://www.abc.com/blog/ to http://localhost/blog.
7. Fix WordPress 404 Error on Local Servers
Many designers and developers install WordPress on their desktops and laptops using a local server for staging purposes. A common issue encountered with local server installations of WordPress is the inability to make permalink rewrite rules work.
When attempting to change permalinks for posts and pages, the website may eventually display the WordPress “404 Not Found” error. In such a situation, enable the rewrite module in your WAMP, XAMPP, or MAMP installation. For this tutorial, I’ll demonstrate using WAMP. Locate the WAMP icon in the taskbar and navigate to Apache → Apache modules.
Enabling the rewrite module involves accessing a comprehensive list of modules that can be toggled on and off. Locate the module named “rewrite_module” in this list and click on it to ensure that it is checked or activated.
Then check whether your permalinks are working or not.
8. Alternative Method
If none of the above solutions work, you may try the alternative method to fix the 404 error.
- Navigate to the local server.
- Find the Apache folder, then go to the “conf” folder.
- Navigate to the httpd.conf file.
- Search for a line that looks like:
#LoadModule rewrite_module modules/mod_rewrite.so
- Remove the “#” sign so it looks like this:
LoadModule rewrite_module modules/mod_rewrite.so
Additional Tip: PHP workers play a crucial role in executing the code of your WordPress site. For instance, an ecommerce site receiving 50,000 visitors per month requires significantly more resources than a simple blog with an equivalent amount of traffic.
Conclusion:
I trust that this guide has assisted you in resolving the “WordPress 404 page error” or the issue of “WordPress permalinks not working.” If you’ve discovered alternative solutions to address this problem, we encourage you to share them with us in the comment section below.
For WordPress users looking to enhance their site performance, consider exploring TextraHost WordPress hosting solutions, which come with a free 2 months extra. Additionally, you may want to explore some WPengine alternatives for the fastest WordPress hosting options.
Frequently Asked Questions
Q. Why am I getting a 404 error?
WordPress 404 errors typically manifest when you’ve deleted specific pages from your website without setting up redirects to active pages. Additionally, these errors can occur if you’ve altered the URL of a particular page.
Q. How do I test a 404 error?
You can utilize various tools to test for WordPress 404 errors, such as Deadlinkchecker. Alternatively, you may access Google Analytics to identify which specific pages or blogs are triggering a 404 error.
Q. How do I fix error 404 on WordPress?
To address the WordPress 404 error, you can resolve it by taking the following steps:
1. Clear your browser’s cache and cookies.
2. Adjust your permalinks settings.
3. Generate a default .htaccess file by saving your Permalinks settings in the WordPress dashboard.
4. Establish a 301 redirect if a page has been moved or renamed.
5. Deactivate plugins and themes to identify potential culprits.
6. Update the WordPress URL in the database by accessing and modifying the wp_options table.
7.Resolve the error on local servers by addressing issues with permalink rewrite rules and ensuring proper server configurations.
Q. How to redirect WordPress 404 pages?
Follow the steps below to redirect WordPress 404 pages:
1. Go to your WordPress dashboard.
2. Navigate to Tools > Redirection.
3. Apply redirection by pasting the broken URL in the source box and the new URL in the Target box.
Q. How to edit a WordPress 404 page?
To edit a WordPress 404 page, follow these steps:
1. Go to your WordPress dashboard.
2. Navigate to Appearance > Theme Editor.
3. Locate the file named “404.php” and proceed to edit the file either on your own or with the assistance of a WordPress developer.
Leave a Comment