How To Customize Your WordPress 404 Error Page
When visitors try to access a page on your site that doesn’t exist, WordPress automatically displays something called a “404” error page.
The “404” error page (also know as a ‘page not found’ error) lets visitors know that whatever they were looking for can’t be found at that URL location.
Addressing 404 errors will not only make a difference to how visitors and search engines perceive your site, but it can also help you recover what would otherwise be lost opportunities to keep visitors longer on your site and potentially turn these into prospects, leads, or new customers.
For example, adding links to your error page pointing visitors to useful pages on your website will improve user experience, increase visitor retention rates, and decrease bounce rates on your site.
In this tutorial we’ll show you some of the ways you can customize your default WordPress 404 page to provide visitors with a better experience if they land on a wrong page and don’t find what they were expecting to see.
Where Is My WordPress 404 Page?
If you are not familiar with 404 error pages, you can see what your own site’s 404 page looks like (or even check to see if you have one), by typing a URL into your internet browser for a page that you know doesn’t exist on your site (e.g.mysite.com/adfgegrgertgrf) …
(A WordPress 404 error page)
WordPress is set to automatically look for the file 404.php when an error 404 is reached. A basic error 404 page is included with the default WordPress theme, but may be missing from some themes. If this file is not present, then it will display a basic error message like the example shown below …
(Page Not Found)
Page Not Found Error – Your Options
There are a number of things that can lead to a “404” or “Page Not Found” error:
- Your post or page has been deleted or moved to another location
- Changes have been made to your permalinks or your page slug
- Changes have been made to a post category or category slug
- Code in your index.php or search.php files has been modified, resulting in invalid addresses being returned
- Web server files (e.g. “mod_rewrite”) have not been installed or are missing. Tip: If you are trying to use Pretty Permalinks (Search-Engine Friendly URLs) and you are getting errors, check with your webhost that mod_rewrite has been installed and is working correctly.
- You have published or promoted a wrong link (e.g. a link containing a misspelling)
- Your visitor has simply typed the wrong URL into their browser
Whatever the reason for getting a “404” error page may be, it’s important to acknowledge that your visitor has made an effort to come to your site and that they are probably going to be left feeling slightly confused or disappointed after arriving on your site and not finding what they expected to see.
So … what are your options when this happens?
You could just do what most people do and ignore the errors, but this will not create a positive outcome for either your visitor (disappointment) or for you (loss of opportunity). If a visitor follows a link to your site and is presented with a 404 page instead of the content they were looking for, it’s highly unlikely that they will search your site to find it. Most likely, they will simply assume that the content no longer exists on your site, and simply look elsewhere.
Additionally, ignoring your “page not found” issues can affect a search engine’s ability to index your site’s pages and impact the bounce rate on your site.
This can lead to poor search engine rankings. One or two 404 errors may not present much of a problem, but if your site is filled with 404 errors, it’s possible that your site will be penalized for having too many invalid links, and this can affect your rankings in the search engines …
(Too many page errors can affect your SEO)
If you choose to do nothing, then at least know that, depending on your theme, WordPress will automatically serve up a “404” page, and this page may include the option of allowing your visitors to search for content on your site …
(Some 404 pages allow visitors to search your site)
If anything, this is better than giving your visitors no option but to click the “back” button on their browser, leave your site and go somewhere else.
Another option is to automatically send all visitors to your home page or another page on your site using a redirect script or plugin when a bad URL is detected. From a visitor’s point of view, however, this may not be very useful or helpful and could add to their confusion and/or lead to more disappointment.
Ideally, you would take steps to prevent a 404 page from showing in the first place. Some of the ways you can prevent “page not found” errors include the following:
- Plan to set up well-structured permalinks from the beginning to avoid changing these the future
- Be proactive: monitor incorrect incoming links, then contact the owners of the websites that are linking to your site and request that these links be corrected. Most site owners will be more than happy to oblige.
- Don’t remove old content on your site unless it’s absolutely necessary to do so, and if you have to, make sure to set up proper redirection and follow correct page migration procedures.
- Look at your site’s analytics, or search online for terms such as “tracking inbound links”, or “reputation management tools” to find tools that can show you which sites are linking to your site.
- Use a plugin like Broken Link Checker to detect and redirect broken links on your site.
In addition to taking steps to prevent errors, the best thing you can do is to be as upfront and helpful as you can be. Think of ways to turn errors into opportunities. Acknowledge the fact that the content they are looking for is missing and try to help your visitors find what they are looking for.
At the very least, your 404 page should provide helpful information and some useful navigation options for your visitors. Explain to them why the page can’t be located and offer suggestions for helping them get to the right area of your site to continue searching.
Here are some ideas to help you create a useful 404 error page:
- Write a clear and simple greeting with apologies for the inconvenience
- Add site branding elements to reassure visitors that they are still on your site, and to give a clear indication of the industry and category your site or business belongs to
- Add helpful navigation options like a search form, links to relevant, recent and/or popular content
- Add links to your home page and your sitemap
- Add a link to your contact page with a simple request for reporting the error
- Add a tag cloud to your page
- Add some promotional content or information about your offers and services (optional)
- Add a notification and/or tracking system to help you identify 404 errors on your site.
Customizing Your WordPress 404 Error Page
A WordPress “404” error page is an actual page file that can be edited. It is typically included with most WordPress themes. You can find this page by logging into your server (e.g. via FTP, cPanel, etc.) and looking for a page called 404.php located inside the wp-content > themes > name of theme folder …
Once you have located the page, you can edit it to improve your visitor’s experience by placing helpful information in your 404 error pages (you can even monetize your 404 error pages by placing ads in it).
Below are just some examples of simple customizations you can make to your WP 404 page.
For example, you can add links pointing visitors to the main pages of your site …
(Direct visitors to the main sections of your website)
You can add links to relevant content, related content, or your latest content …
You can incorporate friendly, funny, clever, witty, or amusing messages …
You can even add a creative touch …
In short, you can customize your 404 error page however you like.
Note: Always make a backup of any files you plan to modify. Editing your WordPress 404 page requires some knowledge of editing PHP files, even if it’s doing something as simple as changing the greeting that your visitors will see when they arrive on your page …
If you are not comfortable editing code, ask someone with web design or PHP experience to do it for you. See the resources section at the bottom of this page for more information about editing your WordPress 404 page template.
WordPress Error 404 Page Plugins
Here are some WordPress plugins that can help you customize your WordPress 404 page and/or prevent, manage, or handle WP 404 errors.
404page is a free plugin that lets you easily create a customized 404 error page in almost any WordPress theme. The plugin also sends a correct 404 error code that tells search engines the page does not exist and should be removed from their index.
After installing and activating the plugin, create a custom 404 error page just like you would create any page using the WordPress Page Editor …
(Create a custom 404 error page)
Next, go to Appearance > 404 Error Page …
(Appearance > 404 Error Page)
Select the page you have created as your custom 404 error page from the drop down menu …
(Select your custom 404 error page)
You can also edit and test your page, and configure other plugin options on this screen. Remember to click ‘Save Changes’ to update your settings …
(404page plugin settings)
The plugin also displays an icon marker next to page you have specified as your custom 404 error page in the Table of Pages …
(404 Error page marker)
The video below provides a brief overview of how to use the plugin to create a custom 404 error page …
(Video – Introduction to the free WordPress plugin 404 page)
For more information about this plugin, go here: 404page
Custom 404 Error Page
(Custom 404 Error Page)
The Custom 404 Error Page plugin lets you customize your WordPress 404 page from your WordPress dashboard. You can select different background colors, choose your text and font settings, add your own custom greetings, and even add links to useful pages …
(Custom 404 Error Page – Plugin Options)
When visitors arrive on your 404 error page, they will now be greeted by a page that looks slightly more personal and useful than the default WordPress 404 error page …
(WordPress Plugin – Custom 404 Error Page)
(WordPress Plugin – Clever Error)
The CleverError plugin replaces your 404 page with an “intelligent” screen that tries to guess what your visitors are looking for, using a contextual search feature and links to your home page to try and prevent users from using the back button and leaving your site …
(WordPress Plugin – Clever Error)
(WordPress Plugin – 404 Redirected)
According to the plugin developer, the 404 Redirected plugin allows you to “convert your 404 traffic by providing your site visitors with a better browsing experience and eliminate 404 URLs on your site.”
The 404 Redirected plugin allows you to control your dead links and redirects from your admin panel …
(404 Redirected – Plugin Settings)
404 Redirected records all URLs that users have visited leading to 404 errors …
(404 Redirected – Visitor Logs)
And then allows you to easily create 301 and 302 redirects to valid pages on your site, to help prevent those errors from happening again …
(404 Redirected – Add Manual Redirect)
- 301 = Permanent Redirection
- 302 = Temporary Redirection
Redirects can be created based on the best possible match for the URL the visitor was most likely trying to reach.
404 Redirected plugin also lets you provide suggestions on your 404 page for users to click on …
(404 Redirected – Suggested Alternatives)
Note: In order to use the “suggestions” feature of this plugin, you will need to insert the line of code below into your existing 404.php page …
To access your 404.php file from your WordPress dashboard select Appearance > Editor from your WordPress administration menu …
(Appearance > Editor)
Wherever you insert the above line of code is where suggestions to other pages will appear on your 404 page …
(Edit Your WordPress To Display Suggestions Feature)
As stated earlier, always make a backup of any files you plan to modify, and if you do not want to edit code yourself, then please ask someone with experience to help you.
Auto Redirect 404 in 301 for Trashed Posts
(WordPress Plugin – AutoRedirect 404)
In terms of search engine optimization, it’s better for search engines to think that content on your site has moved rather than disappeared.
This plugin allows you to redirect posts that have been sent to the trash to your homepage (or to another location that you specify).
The plugin lists deleted page URLs that are being visited, so you can redirect visitors to another page, instead of the 404 error page …
(Auto Redirect 404)
Note: This plugin is used for posts or pages (or categories, tags, media, etc.) that have been deleted from your site. If a visitor searches for something that does not exist on your site, they will be presented with your theme’s usual 404 page.
404 To Start
(WordPress Plugin – 404 to Start)
404 to Start is a simple plugin that allows you to completely bypass the 404 error page and send visitors directly to your home page, or to any other page of your choice.
The plugin allows you to specify whether to make your redirects permanent (301) or temporary (302) and gives you the option to receive an email notification whenever a 404 error occurs …
(WordPress Plugin – 404 to Start Settings)
Note: If you plan to use a customized 404 page, then do not use this plugin, as your visitors will never see your custom 404 page – they will be sent directly to your home page or whatever page you have specified.
Tip: This plugin is useful if you provide content containing links or references to posts or pages on your site that have been scheduled for publishing at a future date.
Simply create a temporary notice page (e.g. “this page coming soon”) and use the 404 to start plugin to redirect all not found links pointing to content that has not been published yet to your temporary page. Remember to set the destination page as a “302” (i.e. temporary) redirect.
404 Error Monitor
(WordPress Plugin – 404 Error Monitor)
This is a simple plugin that logs 404 errors on your WordPress site. It also logs useful information like referrer, user address and error hit count.
This plugin is useful for monitoring 404 errors, especially from external referrers, or if you plan to create manual redirection links.
Note: You don’t need to use this plugin if your current 404 strategy already provides you with a way of monitoring 404 errors.
(WordPress Plugin – 404 Notifier)
If you’ve decided to move things around on your site, you might overlook a few redirects and end up with some broken URLs.
This plugin will help you catch any broken URLs so you can fix them. It logs 404 errors on your site and notifies you of these via e-mail or RSS.
(WordPress Plugin – Smart 404)
Instead of displaying an unhelpful 404 error page on your site when a visitor reaches content that doesn’t exist, you can install the Smart 404 plugin, and it will make an effort to guess what your visitors were after.
The plugin will perform a search of your posts, pages, tags and categories, using keywords from the requested URL. If there’s a match, it will redirect to that content instead of showing the error. If there’s more than one match, the 404 template can use some template tags to provide a list of suggestions to the visitor.
The Smart 404 plugin is also useful if you have recently changed your permalink structure. With minimal or no adjustment, old permalinks will still work.
(WordPress Plugin – Google 404)
The Google 404 widget is a quick and easy way to embed a search box on your custom 404 page and provide users with useful information designed to help them find the information they need. Where it can, the Google widget will also suggest other ways for the user to find the information they need, thus increasing the likelihood that they’ll continue to explore your site.
You should set up a Google webmaster account and submit an XML sitemap of your blog to ensure that the Google 404 widget will perform effectively.
Dunstan-Style Error Page
(Dunstan-Style Error Page)
This plugin lets you create a custom error page similar to the one used on Dunstan Orchard’s 1976design.com/blog.
The custom 404 error page created by this plugin provides useful information to your visitors, including useful links, links to your most recent posts, a search box, the option to contact you and report the error, and more.
More Useful 404 Plugins
The plugins below provide more advanced or unusual options to address 404 errors on your site.
(WordPress Plugin – Redirection)
Redirection is a very useful WordPress plugin that helps you manage 301 redirects, keep track of 404 errors, and generally tidy up any loose ends your site may have.
This plugin is particularly useful if you are migrating pages from an old website, or are changing the directory of your WordPress installation, as it allows you to map your old URLs to your new ones …
Permalinks Moved Permanently
(WordPress Plugin – Permalinks Moved Permanently)
This simple but effective plugin is useful if you change the permalink structure of your site and don’t want to lose any incoming links pointing to your old page URLs.
If you just migrated your WordPress blog from one permalink structure to another, and you don’t want to lose the traffic that accesses your blog through the old permalinks, then consider using this plugin.
Here’s how the plugin works: Right before the old permalink generates a 404 error page, this plugin grabs the slug from the end of the request and checks to see if a post with the same slug is located somewhere else on your site. If so, the plugin will generate a “301 Moved Permanently” error and forward your visitor to the new location of your post.
In addition to redirecting your visitor to the new link, it will also automatically redirect visitors and search engine spiders to the new location in the future.
(WordPress Plugin – Useful 404s)
This plugin sends you email notifications that specify the cause of your errors, allowing you to create more useful 404 pages. The developer of this plugin credits the following article for inspiring the creation of this plugin: A More Useful 404.
WP 404 Images Fix
(WordPress Plugin – WP 404 Images Fix)
This plugin lets you replace images missing from your posts that return a 404 error with an alternative default image of your choice. You also have the option to add a class to the img tag or hide the image if it’s missing.
NotFound.org 404 Page
(WordPress Plugin – NotFound.org)
This is a different type of 404 plugin, as it allows you to turn your error pages into an online “billboard” for helping to locate missing children …
(WordPress Plugin – NotFound.org)
NotFound.org is an organization dedicated to finding missing children. It began its services in Europe but plans to expand to other countries. According to the site …
Thousands of children go missing every year across Europe. Thanks to the NotFound project, you can make a difference. Install our application and a picture of a missing child automatically gets published on every ‘page not found’ of your website. Together, we can find them.
The goal of this plugin is to make it really easy for WordPress users to implement the NotFound.org missing child page instead of their standard 404 page.
404 Error – Additional Resources
Here are some additional useful resources that can help you deal with 404 errors on your WordPress site:
- For resources that can help you check for “dead links” (i.e. links on your site that point nowhere), go here: Check For Dead Links
- For the official WordPress documentation on creating an Error 404 page, go here: Creating An Error 404 Page
Congratulations! Hopefully, now you have a better understanding of what 404 errors are, and some of the ways you can customize your WordPress 404 page to provide not only a better experience for your visitors but also help to minimize lost opportunities on your site.
"Wow! I never knew there's so much to learn about WordPress! I bought one of the WordPress for Dummies three years ago, such authors need to be on this course!" - Rich Law, Create A Blog Now