All websites will have some Page not found (pages with 404 error code) over the time. We cannot avoid having them. Instead we should make them helpful in order to retain our site visitors. In some cases we can redirect 404 pages to relevant content on our website.
Fixing 404 error pages will make site visitors happy. Search engines also will better understand updated content on our website. Website will retain its rank based on existing backlinks.
In this guide we will build a plan on how to deal with 404 pages. We also look at how to find and fix all 404 pages.
Let’s look at our plan for 404 page SEO.
Table of Contents
View video version of this 404 page guide
SEO action plan for 404 pages
To get maximum SEO performance from 404 pages we need an action plan.
Instead of showing a generally helpful 404 page for all not found pages we should find valuable pages (high page rank, page authority, backlinks, high traffic in the past) and 301 redirect them to related pages on our website.
Here is how my 404 page action plan looks.
This plan shows that we should find old valuable pages that return 404 errors and redirect them to related pages on our website.
Important 404 pages that should be 301 redirected are:
- Have some backlinks from other websites.
- Had huge demand/traffic in the past.
- Have some current traffic.
- Fits well within the current niche of your website.
- URLs of images and downloadable files (pdf, zip) changed over time. They should redirect to a related image or page.
When we analyze 404 pages there will be lots of URLs which can be difficult to decide if it is important or not.
To eliminate confusion about importance of 404 URLs here is the clear list of NOT important pages:
- URL probing by bots. – These are common patterns that web bots look for on every website on the planet. For example pages like:
/contact/etc. All sorts of bots looking for various pages which are not related to your website.
- Sample pages by CMS like WordPress. – These are default pages when you install your WordPress website. URLs like
/example-page/etc. Sometimes they may be requested by bots or even indexed by Google. They are not specific to your website.
- Spam backlinks that are irrelevant to our website.
All not important 404 pages can show regular 404 error pages.
Now let’s find important 404 pages that should be redirected.
How to find important 404 pages?
There are many ways to find 404 pages on your website. In some cases you will get a big list of 404 pages with many nonsense URLs.
To find all valuable 404 URLs we need to use more than one way to find them.
Let’s go through each way.
Redirection plugin for WordPress detects 404 pages
This is a free WordPress plugin that monitors 404 pages. Plugin name is “Redirection“.
It sounds like a functionality instead of a plugin name.
Main purpose of the plugin is to detect 404 pages and create custom redirects. For now we will use it to find 404 pages.
Every 404 page handled by WordPress CMS is detected and logged into the “Redirection” plugin. You should install, activate and run the plugin for a couple days in order to log pages with 404 error code.
View 404 pages in Redirection plugin following these steps:
- Navigate to “Tools” → “Redirection” page from WordPress admin dashboard.
- Click on the “404s” tab at the top.
- Select “Group by URL” for grouping and click the “Apply” button.
- You will see the most requested 404 error pages for your blog.
When you check the list you will notice that more than 90% of URLs are not relevant to your website. This is because bots regularly look for vulnerable files on all websites over the internet.
I do not have any of those pages shown in the image above. They are all requested by bots.
By grouping 404 pages by URL you will reduce the list 3-5 times. It will be easier to scan through URLs and find valid requests to your old content.
Take a note of valid 404 pages that should be redirected to a new URL. We will redirect them later after finding all important 404 URLs.
If you are already using Rank Math SEO plugin in your blog then it also has a simpler version of Redirection module that can be used to detect and redirect 404 pages.
404 pages found by web spider in Google Search Console
Google search crawler follows all links on the internet across all websites. It uses links as one of the many ranking factors.
When google crawls your 404 pages this means that there is some page on the internet linking to your missing content.
This can be because of 2 reasons:
- Link from external website (known as backlink).
- Internal link from your own website.
To find 404 pages in Search console:
- Navigate to the “Indexing” → “Pages” page from the left menu in Search Console.
- Click on the “Not found (404)” row if you have some records there.
- On the opened page you will see 404 pages found by google web crawler.
This report will show mostly important pages that have been previously indexed by Google. You will see mostly old pages from your website that had content for some time and now has no content.
Take a note of important 404 pages that can be redirected to a new URL.
You will know important pages by URL. You know old and new pages of your website. When old pages have related pages in your current content then those pages can be redirected to that URL.
There is another report in Search Console that shows more not found resources. This report contains all file types, not only web pages.
Steps to view not found resources report:
- Navigate to the “Settings” page inside Search Console.
- Click on the “Open Report” button for Crawl stats.
- On the opened page click on “Not found (404)” inside the “Crawl requests breakdown” → “By response” panel.
- Opened report will show the latest 404 requests (icons, images, zip, pdf, html, php files).
From this report take a note of important resources that moved to the new URL.
I found some links to zip files and images. Will redirect them to corresponding URLs.
Analyze backlinks using Ahrefs for free
Type in the domain of your website and you will get a report of 100 backlinks for free without registration.
Go through backlinks in the report and take a note of URLs showing 404 error pages.
In the image above I found a backlink to the Flash Photo Gallery page. Which is no longer available. I have a page on my website that explains why Flash Photo Gallery is not available. I also have written a tutorial on that page with instructions on how to create a photo gallery in WordPress . Which might be helpful because Flash is discontinued and the number of WordPress websites growing on the internet. So users can use WordPress Photo Gallery for their needs.
In total I found 5 pages with backlinks currently showing 404 pages. This is a lost opportunity.
We will redirect them to corresponding pages.
How to fix 404 pages?
We want to redirect all important 404 pages with backlinks to related pages on our website.
If we do not have a related page and an old page fits well to our current niche then we can create those missing pages with up to date content.
If those old pages do not fit to our niche then we can create a page explaining why content is removed and offer some alternative solutions to visitors.
Here is a list of some 404 pages from my website with a new URL that I will redirect.
Redirect important pages to relevant pages
Best way to deal with 404 pages is to redirect to relevant content on your website. I found lots of old URLs to my projects currently showing 404 errors. I will redirect them to their new URLs with the 301 redirect rule.
This is important for users and SEO. Lots of websites have links to my old URLs. It will be hard to make them update their links. Instead I can redirect them to the correct URL from my side.
Users will be happy to find that when they click an old link they will find the page they are looking for.
Redirection for WordPress websites can be done in 2 ways:
- Redirect using plugin – easy
- Redirect using server config (Nginx, Apache etc.) – for advanced users.
Redirect using Redirection plugin
There is a popular free plugin in WordPress called “Redirection”. We used it to find some 404 pages above in this article.
Redirection plugin will work only if a particular 404 page is handled by WordPress. Generally all directory URLs are handled by WordPress. For example:
You can add redirect using Redirection plugin in 2 ways:
Add new redirect using Redirection plugin
- Navigate to “Tools” → “Redirection” page from WordPress dashboard.
- Click on the “Add new” button at the top.
- Type in “Source URL” path and “Target URL” path.
- Click the “Add redirect” button for saving a new rule.
Plugin will add 301 type redirects by default. You can adjust more settings for each redirect by clicking the “cog” icon next to the “Close” button.
Redirect from 404 page report page
- From the Redirection Plugin page click on the “404s” tab at the top.
- On the opened page find a 404 page that can be redirected to a new URL.
- Click on “Add redirect” that appears under that page path when you hover on it with your mouse.
- Popup with “Target URL” will be displayed. Type in the “target URL” path that you want to redirect to.
In both options there is a group field. Use it to group 404 redirects for exporting as server config files when needed.
I love this Redirection plugin and use it for redirecting affiliate links and create custom download urls for software projects as well. It helps me to reduce number of plugins low. So I do not need a separate plugin for affiliate links and downloads. Learn how I use it to reduce number of active plugins for speeding up WordPress.
Redirect using server config (Nginx, Apache etc.)
IMPORTANT: Redirection using web server config is for advanced users. Because you can break your server configuration and your website can stop working.
Be careful when updating web server configuration.
You need to use server side redirects when the URL is not handled by WordPress.
On my web server
.zip URLs are not handled by WordPress.
So following URLs are not handled by my WordPress:
They are handled by the Nginx web server.
Redirect rules for web servers are not easy to read. It uses custom rules and formatting.
To generate correct redirect rules easily use the Redirection plugin for WordPress.
Add all redirect rules and group them as Nginx, Apache or Server. So it will be easy to generate code for the config file once you add all redirects to that group.
Adding redirect rules to your WordPress plugin can be helpful for the future as well. Because in future when you move to another web host they will move with your WordPress. Depending on your new host these redirects may work inside WordPress plugins without needing to write them in server config files.
After adding redirect rules we can export it for Nginx / apache config.
Follow these steps to export redirects as Nginx config rules:
- Navigate to “Tools” → “Redirection” page from WordPress dashboard.
- Click on the tab “Import/Export” at the top.
- Scroll down to the Export section. Select group, Select export format as “Nginx rewrite rules” then click “View” button.
- Text field will show with redirect rules. Copy lines that you want to use and paste it to your Nginx config file.
Here is how the generated Nginx rules look like.
I generated some redirect rules using a plugin. Other rules I wrote by following a similar formatting structure.
After I added redirect rules to my Nginx config file. Here is the screenshot.
Remember to restart web server after updating config files. Restart Nginx / Apache.
I advise you to check 404 pages and redirect them once a year.
Adding rules to server config is not easy. If you are not comfortable editing your server config file then ask your web host or hire a developer.
Create useful 404 pages
Make sure that when users land on a 404 page they can navigate to other parts of your website following links.
Regular 404 pages should show links to the home page, links to important pages. You can even show a search box so visitors can search within your website for desired content.
Here is how my 404 page looks.
This 404 page is generated by WordPress and provided by my theme.
What about requests that are not handled by WordPress?
We need to show similar 404 pages from the web server as well. Let’s see how to do it.
Show helpful 404 pages from your server software
As I mentioned earlier I use a Nginx web server and requests to
.zip are not handled by WordPress.
Default server (Nginx, Apache etc.) error looks empty and does not have useful links.
Any visitor seeing this unhelpful 404 page will leave your website.
That is what you probably do when you see a page like this.
How to show a helpful 404 page generated by WordPress instead of the default Nginx error?
Here are steps to show the static version of WordPress error page in Nginx.
- Load error page generated by WordPress. Type in an non existing URL on your website that shows WordPress 404 page. Make sure you are logged out of wordpress.
- Click Ctrl+U to view the source code of the page. Copy all code and paste it to the new
_404.htmlfile. Upload file to your server.
- Edit Nginx config file and append
error_page 404 /_404.html;code inside
Now when you visit the 404 page served by Nginx you will see a static html file formatted as a regular 404 page by WordPress.
Updating your default error page will help users to navigate and use your website.
What does 404 and 301 codes mean for SEO?
- 404 status code – Page not found. SEO meaning: Dismiss all backlink juice. Remove page from search engine index.
- 301 status code – Resource moved permanently to new URL. SEO meaning: Transfer all backlink juice to a new URL. Rank and show redirected pages in search engine results.
Why is it better to 301 redirect some 404 pages?
Because gaining high page authority via backlinks requires a lot more time and effort.
In order to get natural backlinks you need to:
- Do keyword research.
- Create content.
- Internal link and share content.
- Get indexed by search engines.
- Get ranked by search engines.
- Get found by real users.
- Get backlinks from users that value your content.
From start to ranking and getting natural backlinks takes 6-12 months.
Redirecting 404 pages with high page authority to relevant content on your website is a quick fix that retains all SEO power of backlinks gained over a long period in the past.
Should I redirect all 404 pages to the homepage ?
No, you need to have regular 404 pages for SEO and for users. Your home page is valuable and should not be mistaken as a 404 page by search engines. Also all spam links to not existing content will end up in your homepage when you redirect them.
404 says there is no such page and remove all references to it from your index, do not rank and promote this irrelevant content. My website is not related to it any more.
So it is better to have a regular 404 page for securing your website from unrelated content and false association.
Conclusion on 404 page SEO
Perform regular 404 monitoring at least once every year. You will find lots of valuable pages that can be redirected to relevant content. Also check how different 404 pages show up in the web browser. Check 404 for images, php files, zip files. If they are not showing helpful 404 pages then fix it by updating your server config.
We learned which 404 pages are important, how to find all valid 404 pages, how to avoid/ignore bot generated 404 pages. After finding error pages you can fix it with the WordPress plugin. What is not handled by WordPress, redirect using server config file.
During this optimization I found several 404 links to my software projects. I fixed them by 301 redirecting to their updated URLs.
Fixing 404 pages is part of the search engine optimization . After all 404 pages fixed your website will be more user friendly and retain its backlink power. Users will know that your site is working when they land on a related page or view a useful 404 page with navigation links.