It has happen to all of us at some point—you click a link and end up on a page with the message “404 – Page not found“. What do you do next? You click away right?
As a website owner you’ll want to track down and fix broken links that are triggering 404 errors to improve user experience and to help your website’s SEO ranking.
What is a 404 error?
A 404 error (pronounced “four oh four”) is a standard response code that is triggered when the server can’t find what was requested. When the requested page can’t be found the website displays an error page. Also known as a “Not Found” error, the 404 error is the most recognizable error on the Web.
Your WordPress theme will include a default 404 error page template that displays in place of the page that can’t be found.
What causes a 404 error?
A 404 error occurs when a user clicks on a broken or dead link.
- The page they are looking for may have been moved to trash (deleted),
- the permalink was changed, or
- perhaps there is a typo in a link misdirecting visitors to a page that never existed.
A 404 error may also occur when a user mistypes a URL directly into the address bar.
Why you need to fix 404 errors
There are at least two reasons you want to find and fix broken links that are triggering 404 errors in your WordPress website:
- For User Experience: Few website visitors who encounter a 404 error will spend time trying to find the right link. More often than not, they will click away.
- For SEO: Broken links negatively influence user experience and your site’s credibility. Google cares about giving a user the best possible search experience. We also know that Google includes a usability metric as part of their ranking algorithm. When Google crawls your site and finds broken internal links triggering a 404 error, your site’s SEO ranking decreases. This means that broken links will impact your website ranking in organic search results.
How to find 404 errors
Begin by following our instructions to connect the Yoast SEO Plugin and Google Search Console.
Once your site has been connected you will be able to find error logs under SEO → Search Console.
Then you will be able to see the Search Console error logs without leaving your WordPress site. This log is a record of URLs that need to be cleaned up. Periodically check the log and fix them.
Seeing suspicious 404 errors?
You may see a number of crawl errors that make no sense. Don’t worry, there’s no need to be alarmed. 404 errors on invalid URLs do not harm your site’s indexing or ranking in any way. Hacker bots are exploring your WordPress site looking for vulnerabilities when they don’t find what they are looking for, they land on your 404 error page.
If these errors concern you, try the iThemes Security plugin which includes a 404 Detection option. “If a bot is scanning your site for vulnerabilities, it will generate a lot of 404 errors. iThemes Security will lock out that IP after the limit you set (20 errors in 5 minutes by default).” This will not only make your WordPress site more secure but will also reduce the number of invalid URLs in your 404 error log. If your site is on WordPress managed hosting, you should check with your host if this plugin is necessary and compatible.
How to fix 404 errors with 301 redirects
Prevent errors in the first place.
Think twice before you delete a page, post, category or tag. If the blog post is old, consider rewriting it, keeping the permalink unchanged. Can you make the content evergreen-content? But if you do want to delete the content, before trashing it, make note of the URL —you will need this to create what is known as a 301 redirect.
A 301 redirect is a permanent redirect telling the browser and Google, when a site visitor tries to access this URL, send them to this URL instead.
301 Redirects & Page Speed
Page speed is an important ranking factor with Google. Since it is a waste of time to go to one place just to be redirected to another, redirects slow down the user’s experience. Whenever possible, don’t create a redirect. Go to the original source and fix the broken link.
- If you are interlinking from one blog post to another, go through your own content and update any links, don’t just rely on a 301 redirect to reroute traffic.
- If someone has linked to your site and for whatever reason the link is now broken, contact them and ask them to fix it.
Many WordPress redirect plugins store 301 redirects in the WordPress database. Unfortunately, this method will make your site slower.
It is preferable to create 301 redirects in your website’s .htaccess file. The .htaccess file loads before the WordPress database, making the redirection faster. Read this post for instructions how to create 301 redirects in the .htaccess file without a WordPress plugin.
Even faster—if your site is hosted by WPEngine (affiliate link), create redirects in the WPEngine User Portal. Redirects created at the host level will launch before the .htaccess file.