Handling 404 Pages in WordPress
Let us learn about handling 404 Pages while using WordPress. Visitors encounter errors and 404 “Page not found” even while visiting the best websites.
Let us take a scenario that you recently moved to a new hosting server or rebuilt the entire website, as a site administrator, you tried your best to delete out-of-date posts and keep all links up and running but another website may have a link to your inside page for that post which doesn’t exist. When a user clicks on a link to a missing page, they get message of 404 Not Found.
404 will definitely effect your SEO Score and overall user experience, but don’t worry we do have solution for this and believe me it is quite easy to fix 404 error pages in WordPress. In this article, we will show you few manual steps and some of the best plugins for WordPress to fix 404 redirect and 404 Not found Error page.
First Let us understand – why WordPress outputs a 404 error ?
1. Most common reason is when you have deleted any page or post, it will result in 404 page not found error. As mentioned earlier you do not have control on any previous url or link to your website which is already circulated on the Internet.
2. Making changes to URL Structures or Permalink Settings.
If you make changes to the URL structure using default WordPress Permalink Settings or any other plugin, it will update and change the entire url of your blog or website and any previous link circulated on the Interne will result in 404 Page Not found even for the existing pages.
3. Missing or corrupt .htaccess file can also result in 404 Page Not found error. Sometime .htaccess file is not writable and you may not be able to save any Changes to URL Structure settings to .htaccess file.
4. Moving from https:// to https:// , any changes to WordPress Address (URL) or Site Address (URL). This is a rare scenario when you started your website or WordPress page with https:// and your ssl is expired or no more in use, or when you have made any changes to WordPress Address (URL) or Site Address (URL), i.e including www or excluding www from your website. These above scenarios may also result in 404 Page not found error message.
The best way to fix 404 Error Page is by redirecting users to new location by adding a 301 redirect header message. This retain your visitors and offer a great user experience without losing search engine rankings.
Below are few solution to 404 Page and some of the most popular and free 404 redirect plugins for WordPress that can help you handle and manage these issues.
Manual method to have all 404 errors redirected to the blog’s home page.
1. Locate and take backup of your existing 404.php file. You may download and save it or rename it to keep original copy of 404.php. This will help you restore and get back to the original 404 configuration. Let us rename the original 404.php to 404-backup.php for this example.
2. Copy below code on text editor or Notpad and save this file as 404.php using save As and save as type should be “All Files” option, ensure that you have saved this new file will .php extension.
"HTTP/1.1 301 Moved Permanently"
3. Now upload this new 404.php file to wordpress active theme folder. Here is path for the same
4. All done ! now all your broken links / URL should be redirect to your homepage.
Using WordPress Plugin to manage 404 error page and 404 redirected to home page.
Redirection is a free and popular WordPress plugin will helps you to easily manage and redirect 404 pages. You can even keep track of all 404 error pages and redirect them to homepage. Not only broken links but you can even redirect existing urls to any specific location. Redirection Plugin allows you to manually add 301, 302, and 307 redirections for a WordPress post, or for any other file.
This plugin provides you to redirection statistics telling you how many times a redirection has occurred, when it last happened, who tried to do it, and where they found your URL.
This Plugin is very useful if you have moved a site with a different URL structure to WordPress.
2. All 404 Redirect to Homepage
All 404 Redirect to Homepage – is free and open source plugin for WordPress. It is a simple plugin which will redirect all 404 error pages to home page or any customized page. This plugin is easy to use and very useful.
3. Forty Four – 404 Plugin for WordPress
Forty Four is a free WordPress plugin that allows you to easily replace your theme’s default 404 page with a custom page. Forty Four Plugin creates custom page design that you can modify easily on Appearance > 404 Page. It doesn’t load the unnecessary scripts, css, images and other links to 404 page. This plugins also allows you to edit the 404 page, use a full screen background image, and change its colors and text.