When visiting a website, we might ever see an Error 404 Page Not Found message in the web browser. The issue is usually on the webserver, on the server level, or on the application level. Like any other HTTP status code, for example, error 502 on WordPress, an Error 404 page not found message is fairly easy to fix.
In this article, we will show you how to fix 404 error not found on WordPress. We will also explain what 404 errors are and what causes them.
Table of Contents
What Does Error 404 Not Found Mean?
A 404 Error Page Not Found message is an HTTP status code which means that the webserver is unable to find the requested resource. For example, when a visitor request http://yourdomain.com/yourlogo.png, the webserver is unable to locate the yourlogo.png file, hence the error. The webserver will respond to the request with an error 404 message. Ideally, visitors should never see an error 404 message.
What Causes Error 404 Not Found?
The error 404 not found is usually caused when a visitor tries to access a webpage that doesn’t exist. There are a couple of reasons that could cause the error 404 not found on WordPress.
- the resource has been moved or deleted
- typo in the URLs
- compatibility between plugins and/or themes
- caching issue
- server misconfiguration
The ‘Error 404 not found’ issue is not good for you and your website’s visitors, and search engines like Google do not like it either. For example, the issue can impact your WordPress website performance, because the 404 responses are usually not cached. Also, if a permalink issue is causing error 404 not found on all links, a search engine like Google would not be able to crawl your website’s contents. To prevent them from happening, you would need to solve the ‘error 404 not found’ issue immediately.
How to Fix Error 404 Not Found
While most error 404 messages are returned by the webserver as a result of missing resources, a simple typo or misspelled URLs can also trigger this. There are some steps you can follow to fix this error 404 not found on WordPress.
1. Reset Permalinks
If the ‘error 404 not found’ issue is on all your WordPress links, most likely it’s related to WordPress permalinks. To solve this, you can follow the steps below.
- Log in to your WordPress admin dashboard
- Go to Settings > Permalinks, remember you current setting because we are going to switch to another option temporarily
- Select the Plain radio button and click Save Changes at the bottom of the page.
Once saved, click on the previous pretty permalink option you previously had then click Save Changes again.
After resetting the permalink, you can check your posts or pages that had issues with the ‘error 404 not found’ message. You shouldn’t see any more 404 errors after this.
If the issue remains, try resetting your permalinks manually by editing the .htaccess file.
In a single WordPress installation, you can use the default WordPress .htaccess, make sure you have the following in the .htaccess file.
# 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
If your WordPress website is a multisite installation under subdomains, use the following .htaccess rule.
# BEGIN WordPress RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteRule ^wp-admin$ wp-admin/ [R=301,L] RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^ - [L] RewriteRule ^(wp-(content|admin|includes).*) $1 [L] RewriteRule ^(.*\.php)$ $1 [L] RewriteRule . index.php [L] # END WordPress
And, if it’s a multisite installation under subdirectories, you can use the following .htaccess rule.
# BEGIN WordPress RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L] RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^ - [L] RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L] RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L] RewriteRule . index.php [L] # END WordPress
2. Enable mod_rewrite
The apache module called mod_rewrite is responsible to make your .htaccess rule work. If your WordPress website is running on Apache, make sure to enable mod_rewrite. The module is enabled by default in CentOS, but not in Ubuntu. To enable the module, you can run this command below in your Ubuntu server.
$ sudo a2enmod rewrite
$ sudo systemctl restart apache2
3. Disable plugin
If you still have the ‘error 404’ issue after checking with the mentioned steps above, you would want to deactivate your plugins in your WordPress dashboard. Or, if you do not have access to the backend or it also is returning error 404 then you can disable the plugins by renaming specific plugin names in wp-content/plugins/
directory.
If you have shell access to the server where your website is hosted, you can use WP-CLI. WP CLI is a command line interface that enables us to interact and manage our WordPress installation like deactivating a plugin, theme, adding users, etc. When using WP CLI, you can run this command to deactivate a plugin named ‘myplugin’ in your WordPress webroot.
$ wp plugin deactivate myplugin
Or, if you want to disable all plugins, run this command:
$ wp plugin deactivate --all
That’s it! You have learned how to fix the ‘error 404 not found’ message on your WordPress website.
Of course, you don’t need to solve this ‘error 404’ issue if you have a managed WordPress VPS hosted with us – in which case, our technical support team will help you investigate and solve this Error 404 Not Found on WordPress immediately. Our technical support team is available 24/7 and can cater to any questions or requests.
PS. If you liked this post, feel free to share it with your friends by using the social media share shortcuts below, or simply leave a comment. Thanks.