To serve your readers the best, you never want to send someone to a post or page that doesn’t exist on your website. When you do, you’re sending someone to a 404 error page. What does that mean? And how do you fix it? In reality, there are lots of other kinds of errors your website can have on top of 404 errors that you’ll want to fix to serve your readers better. Here’s how to do it.
What is a HTTP Status Code?
You’re familiar with http—it’s the bit that goes in front of your url in your browser. But do you know that it means HyperText Transfer Protocol? Basically, it’s directions for your browser to access a server and request information to display to you, the user. When things go correctly, you don’t even notice what’s happening. You simply type in the URL and like magic, you’re at the thing you were looking for.
But what happens when you can’t get there? You might get a 404 error.
404 means that the item you asked the server to present to you can’t be found. Usually this means the page or post was deleted or moved to a new URL or you typed in the wrong thing. But 404 isn’t the only code your browser might get from the server after you hit enter. There are lots of these codes, called HTTP Status Codes.
They’re organized in groups of 100 for different purposes:
- HTTP Status Codes 100-101 – Informational Status Codes – These are intermediary status codes as your browser makes the request from the server.
- HTTP Status Codes 200-206 – Successful Status Codes – These are status codes for successful retrieval of information (kind of).
- HTTP Status Codes 300-307 – Redirection Status Codes – These are status codes for when stuff has moved somewhere else on the server.
- HTTP Status Codes 400-416 – Client Error Status Codes – These are status codes for when you, the user, makes an error (or your browser does).
- HTTP Status Codes 500-505 – Server Error Status Codes – These are status codes for when the website’s server makes an error.
Why do you need to know more about these than just a 404? Because sometimes you might need to change a 404 to a 301 because you moved the content to another place. Or maybe your server is producing a lot to 503 errors because your domain hosting isn’t great. Learning to speak server a little bit can help you solve problems with your blog.
Finding 404 Errors on your Website
There are a lot of great tools out there to find 404 errors but when we’re talking about SEO and serving our users best, the first place to start is Google Webmaster Tools.
After Google crawls your website and indexes your content, it checks up on it every once in a while to make sure it’s still there. If it finds that something has gone missing, it will tell you so you can correct the problem. There might be other errors on your website than what Google has found but it’s important to fix these first because Google might be sending traffic to them via search.
In Google Webmaster Tools, navigate to Crawl Errors and you’ll find either that your website has had no errors for the past 90 days or a chart with some errors.
These are called Soft 404 errors. They’re not 404s but Google thinks they might be because of how they are reacting to their requests. Fixing these as soon as possible is important because they could turn into 404 errors. As you can see, Google indexed part of my site I didn’t want it to because I forgot to include it in my robots.txt file. Whoops! To fix this one, I need to add wp-content/themes to my robots.txt file and then mark these two errors as fixed in Webmaster Tools. (If this is a bunch of gibberish to you, that’s okay! I’m releasing an SEO book that will teach you what all these weird words mean in a few weeks.)
If you see something else here than things you don’t want people to see anyway, you’ll need to dig down to what’s going on with that content and find the best solution. If it’s a post you want people to read, you might need to set up a 301 redirect to send your readers to the correct place.
I’ve slowly been working to correct errors lately, as you can see that my errors went down recently. If you haven’t been and noticed a drop in your Not Found errors, which are 404s, it’s likely because Google has deindexed those pages and no longer cares about them. See why it’s important you take a peek at these every once in a while?
As you can see, some of these pages aren’t things I care about. I’ll leave these ones alone and eventually, they’ll disappear naturally. However, the second one down is. The post actually lives at a very very similar URL, just without the “this” included. I’m not sure why it was changed—but fixing it is important. I need to set up a 301 redirect from the URL above to the correct one.
How do you set up a 301 Redirect?
You’ll find that most people tell you to use a plugin or edit your htaccess file in the Yoast SEO plugin. The htaccess file is where redirect information lives.
Don’t do it this way.
If you screw it up, you’ll break your WordPress website and you may not be able to get back into your backend. I’ve seen it happen!
To correctly set up 301 redirects, you’ll need to access your FTP server and edit your htaccess file on the server side. Why? If you screw up, you can still get in! To add a 301 redirect, follow these steps:
- Navigate to the htaccess file in your FTP server.
- Download it and save it on your computer.
- Edit the file and save it as a new file on your computer. You should have both the file you downloaded and your changes.
- Above #BEGIN WordPress, write the following, changing out the urls as needed:
# User added 301 Redirects
Redirect 301 /old-page.html http://www.site.com/new-page/
- Replace the old file with the new file in your FTP server.
- Check your redirect by navigating to the old page and seeing if it reroutes you to the new page
And volia! You’ve fixed the errors. Then just hop in Webmaster tools and mark them as fixed.