Encountering 404 Error in WordPress is irritating, especially when your post or page still exists. Even though WordPress CMS is an error-free and secure tool in terms of performance, at times little tweaks or errors can make your site inaccessible to visitors. 404s are such glitches that need to be intervened instantly and eliminated, so that your site can get back on its right track.
Where does the popping up of the 404 error page issue lie?
Pretty permalink fix
The basic cause is that the Apache extension ‘mod_rewrite is not set properly, so it is unable to rewrite your URLs according to the previously chosen pretty permalinks. Permalinks mean permanent URLs associated with the posts, categories and other posting lists of your website.
Besides the default option, permalink URLs can have other alternatives like the post title, or the date when it was written. You will need to determine what to display in the permalinks when WordPress gets installed. Therefore, whenever, Apache extension gets disabled, or if there are some inconsistencies in plugin and theme, pretty permalinks stop functioning.
To fix this Apache extension issue, troubleshoot the permalink setting. Without making any alterations, first, update the setting from the admin dashboard. If you are unable to resolve the issues with permalinks manually, then you can go for the reset WordPress alternative. It will resolve all the 404 errors too.
Via .htaccess file manually reset
You can access .htaccessfile for editing via cPanel, SSH, FTP, or the command line. Two ways to edit .htaccess file –
- Download the .htaccess file copy and edit it in a compatible text editor before uploading and replacing the original file.
- Use FTP or SSH to directly edit .htaccess file on the server-side and save these alterations.
Before editing have a backup of your WordPress site, because if anything goes wrong, your original site can be restored and tried again. Replace the .htaccess file’s default code applicable to your setup and save. Thus the rewrite rules get cleared and errors resolved.
Fix custom post types
Custom post types need an extra step to fix. Check unique slugs and titles for every custom post type. If a couple or more posts have the same slug or titles, then change them. Only a single post can have a particular slug and title, so switch the duplicate ones to something unique.
Besides changing the slug or title, update them. Reset the permalinks manually or automatically as mentioned above. Visit the custom post type’s page to confirm the fixing of the issue.
Use relevant plugins for better SEO
Whenever you take steps to fix WP 404 errors, some sections of your site might still be inaccessible to visitors, and search engines don’t like this either.
You can useful plugins like 301 Redirect WordPress and send the users to relevant or updated pages. It is an effective SEO practice, as it allows you to regain the lost traffic due to 404 errors. We recommend this plugin to all WP developers and theme designers.