HTTP Status Codes and SEO

What is an HTTP Status code?

Whenever you’re opening a web page, your browser gets a response from the server. Part of that response is the status code, telling your browser if the request went well, and what exactly happened. The status code is a 3-digit code. Some well-known status codes are:

  • 200: OK
  • 301: Moved permanently
  • 404: Not found

Just like your browser, search engines also get an HTTP status code when they are crawling your website. As an SEO, it’s important to know how status codes affect the indexation of your pages. A page that works would normally return a 200 status code.

HTTP request and response

Finding the status code

Your browser's network tab

To find the status code of your page, let’s have a look at the Network Tab in Chrome Dev tools (or similar tools in other browsers). For every request, you’ll see the status code:

Network tab with http status codes

Also, note that status codes are not just sent for web pages. Every image, javascript file, stylesheet, and any other file type also responds with a status code.

Redirect path extension

To quickly see the response code of a page, we recommend installing the Redirect Path Extension. This shows you the status code in your browser window, without having to open the network tab.

Status code categories

Status codes can be grouped by their first digit:

  • 2XX: OK: everything worked, here’s the page you were looking for.
  • 3XX: Redirected: you’re opening a page, but we’re going to send you somewhere else.
  • 4XX: Client error: you tried opening this page, but you won’t get it. Either because it doesn’t exist, because you tried too many times, because you’re not allowed to, etc.
  • 5XX: Server error: you tried opening this page, but there’s an issue on our end. 

Status codes and SEO

Why status codes are important for SEO

Based on the status code (amongst other things), Google and other search engines will decide if it will index your page or not. For example, if you’re returning a 404 status code, Google will not index that page. Therefore, sending the right status code is crucial to rank in search engines.

The most important HTTP status codes for SEO

200 - Success

Everything works. This is the status code you normally return when a page can be opened. Google will crawl the page and add it to its indexing pipeline. Of course, returning a 200 status code is not enough to rank in Google, but it’s a good start.

Similar codes are 201 (created) and 202 (accepted). Normally, you should just use 200.

301 - Moved permanently

There used to be a page on this URL, but it has moved, and won’t come back. A normal visitor will directly be forwarded to the new URL, and normally will only see a change in the address bar. 

301 redirects are cached by the browser. That means even after removing the redirect, visitors might still be redirected. If you don’t want that, use a 302 redirect instead.

Although Google hasn’t confirmed it, it is generally believed that for a 301 redirect, Google transfers most ‘SEO value’ of a URL to the new URL.

The 308 (moved permanently) is equivalent and has the same effect

302 - Found / Moved temporarily

Just like a 301, a 302 status code will redirect visitors to a different page. The main difference is that unlike a 301, a 302 redirect is temporary. This has 2 effects:

Redirects will not be cached by the visitor’s browser. If you later change or remove the redirect, the visitor will see the original page.

Search engines will consider a 302 as a weak signal that the new URL should be used, whereas a 301 redirect is considered a strong signal.

When to use a 301 vs. a 302 redirect?

If you’re 100% sure that the URL has changed and won’t change back, use a 301. This makes the user experience faster (using the cached redirects) and helps search engines use the new URL faster.

If you’re not 100% sure and things might change or be rolled back in the near future, use a 302 instead.

The 303 (see other) or 307 (temporary redirect) are equivalent and have the same effect.

404 - not found

This page doesn't exist. Either because it's been removed, or because it never existed. Search engines will remove pages like this from their index, and won't crawl them again. More about 404 pages.

How Google handles status codes

Code Meaning What will Google do?
200 OK Index the page
301 Moved permanently Follow the redirect, and use the redirect target as a canonical
(strong signal)
302 Moved temporarily Follow the redirect, but don’t directly consider the redirect target as a canonical
(weak signal)
404 Not found Don’t index, and remove if it was indexed already
429 Server is overloaded Crawl your website more slowly
4XX Forbidden, gone, unauthorized Don’t index, and remove if it was indexed already
(the only exception is 429)
5XX Server error Crawl your website more slowly

Google has an extensive document about how it responds to status codes.

Common SEO mistakes related to status codes

Returning a 200 for a page that doesn’t exist.

If a page doesn’t exist, and you return a 200 response code, that page might be indexed by Google. This is also called a soft 404. You don’t want those pages to show up in the Google index, or waste any crawl budget on it. Therefore, make sure you return a 404 status code instead.

Google is smart enough to recognize a 404 error page that returns a ‘200 - OK’ status code, so it might not be indexed. However, it’s better to be safe than sorry and return a proper 404 code.

301 / 302 codes for a page that never existed

Redirect codes are great for sending people to the right URL when a URL has changed, or when smaller articles have been merged into one article on a new URL. But you should not use redirects when a page never existed. 

We often see sites that redirect all 404 pages to the homepage. As a visitor, this is confusing: I was looking for a certain page but ended up on the homepage without being told that the thing I was looking for is gone. Instead, showing a good 404 page is a better option.

Returning a 404 for a page that works

This one is rarer but has a very serious impact. If you’re accidentally returning a 404 response code for a page that works, that page will most likely never be indexed. Google takes the 404 and assumes the page is an error. Fix it by returning a 200 - OK code instead.

The 301/302 redirect debate

We briefly touched upon the difference between a 301 and 302 redirect. This is a much-debated topic in the SEO world. The general wisdom is that Google will pass any SEO value of a 301 redirect to the new page, whereas it won’t do that for a 302 redirect.

The reality is probably more nuanced. Google has said that both a 301 and 302 will pass Pagerank (if that still exists) to the new page. We believe that if you’ve moved a page and are not planning on reverting that change, you should use a 301 redirect (Moved Permanently). This speeds up the user experience and indexation of the new page. 

For some big migrations that are considered risky, it can be safer to start with a 302 redirect that’s easy to revert. Once you’ve confirmed everything works, you can change the 302s to 301s.

Hungry for more status codes? Wikipedia has a list of all possible status codes, including 418 - I am a Teapot

404 pages