WordPress
By:
Sushil Pradhananga
Published On :
March 8, 2023
When a page or post cannot be found on your WordPress website, the ‘404 not found error‘ is displayed, which means your requested URL was not found. This error 404 page can occur unexpectedly or following modifications to your WordPress site. This is one of the most basic and irritating types of error in WordPress websites.
Fortunately, rectifying this error is a simple process that requires no technical expertise. In this guide, we will outline the steps involved in resolving 404 errors for posts in WordPress.
While WordPress is an incredibly versatile platform, its adaptability can also be a source of challenges. In some cases, when you modify too many settings, unexpected errors may arise, and your website may crash. There are various tricks and tips to fix error 404 not found error on the WordPress page, which we are going to discuss below.
When a user gets a 404 error message, it indicates that the server cannot locate the file that has been requested.
For example, if you attempt to access a particular URL (such as domain.com/what-is-WordPress) and there is no content associated with that name, a 404 error message will be displayed.
This error is not related to the server itself, but rather, indicates that the requested file (whether it be an image, page, or post) is missing.
The precise wording of the error message may vary slightly depending on the browser being used. For instance, Google Chrome may display the message “404. That’s an error. The requested URL /~ was not found on this server. That’s all we know.”
If you’re encountering a “404 error page not found” with your WordPress posts, it typically means there’s an issue with your links. To resolve this, it’s often possible to fix the problem by ensuring that your permalinks are correctly set up and saved. Setting up the permalinks will definitely help fix error 404. Additionally, you may need to reset your linking structure by modifying your .htaccess file to fix this issue.
Most of the time solution for WordPress error 404 not found is to save the permalink from the WordPress dashboard.
Updating the permalink form WordPress dashboard will automatically update the .htacess file with the correct configuration that is needed for the URL structure to work perfectly for your WordPress website and to get rid of 404 error in WordPress.
In order to save your permalink,
This should most of the time solve the 404 not found error.
In case the WordPress error 404 persists even after saving the permalinks, you have the option to reset it manually by modifying the .htaccess file. To achieve this, you need to access your website files using FTP. Once you have connected through FTP, navigate to the .htaccess file and modify it accordingly.
Add in one of the following codes, save, and upload the updated file to your server:
a) Reset permalinks when your site is in the main domain
If your site is on the main domain, e.g. www.yoursite.com, add this code to your .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
After editing and uploading the file, refresh your site and access posts and pages to see if this fixes your WordPress error 404 issues.
b) Reset permalinks if your site is in a subdomain and fix WordPress 404 Error
If your site is installed in a subdomain, such as blog.yoursite.com, use this code instead.
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]
c) Reset permalinks when your site is in a subdirectory
If your site is on a subdirectory, such as www.yoursite.com/blog, edit .htaccess to include this code instead.
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]
To effectively fix the 404 error page not found on your site, the most suitable solution is to implement a 301 redirect. However, it is crucial to ensure that the redirection is done correctly and the pages are redirected to the appropriate pages.
If you are using WordPress, you can utilize a free Redirection plugin to assist with fixing redirects. After installation and configuration, you can navigate to the “Tools” menu, select “Redirection,” and enter the 404 page URL in the “Source URL” box and the new working URL in the “Target URL” box.
Following is the screenshot of the steps to be followed :
Although it’s advisable to follow the above tips to minimize 404 errors, it’s impossible to entirely eliminate and track 404 errors as certain factors may be beyond your control. It’s common for small WordPress sites to encounter thousands of 404 errors each month. You can create a user-friendly error page to let users know you have landed on a page that doesn’t exist.
To enhance the user experience and make specific pages more user-friendly, you can utilize one of the numerous 404-page plugins available. For instance, by using the free 404-page plugin, you can customize a 404 error page to create your own custom 404 page instead of a broken page. You can include features such as a search box, important links, and contact information in your custom 404 error page besides showing the error 404 not found message, to make the page more interactive.
However, it’s important to remember to keep your 404 page light to improve overall performance.
By taking a proactive approach, it is essential to examine which requests are causing 404 errors on your website. This can assist you in:
Identifying broken links that redirect visitors to an unavailable page returning 404 error on your site. Eventually, you can take remedial action to repair such broken links.
Determining which pages or content are having difficulty being viewed by Google crawlers. Then, you can make necessary adjustments, primarily by implementing a redirect.
Resolving problems and enhancing performance related to WordPress 404 not found errors.
There are various tools available to monitor 404 errors on your website:
Let’s talk about your business goal and align the solution we provide with our digital marketing services.
FREE strategy call© Humming Web. All Rights Reserved