Skip to main content

Tag: H

HTTP status code

What is an HTTP status code?

An HTTP status code is a three-digit code that a web server returns in answer to every request from a browser or a crawler. The HTTP status code signals whether the request succeeded, was redirected or failed. The first digit assigns every code to one of five classes (1xx to 5xx). For SEO the codes 200, 301, 302, 304, 404, 410 and 503 matter most, because they control how Google crawls and indexes pages.

HTTP status code explained: the three-digit server signals 200, 301, 404 and 503 for requests on the web

Every call to a web page triggers a request to a server in the background. The server answers with an HTTP status code before the actual content is transferred. For visitors that code usually stays invisible. For search engines it is the central signal for whether a page can be retrieved and belongs in the index. The codes are defined identically for crawlers and browsers in the RFC 9110 standard.

HTTP status code at a glance

Property Detail
Word class noun (an HTTP status code), also written HTTP status code or shortened to status code
Abbreviation HTTP = Hypertext Transfer Protocol
Pronunciation “aitch-tee-tee-pee STAY-tus code”
Standard RFC 9110 (HTTP Semantics), previously RFC 7231 and RFC 2616
Structure three-digit number (100 to 599) plus an optional reason phrase, for example “200 OK”
Related terms redirect, 301 redirect, canonical, crawling, indexing

How is an HTTP status code structured?

An HTTP status code consists of a three-digit number and a short piece of plain text, the so-called reason phrase. The number sits between 100 and 599, and the first digit sets the class. The status code stands in the first line of the server answer, the status line, ahead of all headers and the actual content.

A typical successful server answer looks like this in raw form:

HTTP/1.1 200 OK
Content-Type: text/html; charset=UTF-8
Content-Length: 3271
Cache-Control: max-age=3600

For a redirect the server also names the target in the Location header:

HTTP/1.1 301 Moved Permanently
Location: https://example.com/new-page/

The reason phrase (OK, Not Found, Moved Permanently) only exists to make the answer readable for humans. Search engines and browsers evaluate the three-digit number alone. Wrong text with a correct number therefore changes nothing, while a wrong number changes everything.

Request and response: how an HTTP status code is createdThe browser sends a request to the server. The server answers with an HTTP status code such as 200 OK, which signals whether the request succeeded.Browser / Crawlersends the requestWeb serverreturns the status codeGET /page/200 OKThe status code sits in the first line of the response.The first digit (2xx) reveals the class: success in this case.Fig. 1 · taismo
Fig. 1: Request and response, how an HTTP status code travels between browser and server.

Which status code classes are there?

There are 5 classes of HTTP status codes, sorted by the first digit. Every class stands for one kind of answer: information, success, redirect, client error or server error.

Class Meaning Typical codes
1xx Informational: the request is running, the server keeps the process open 100 Continue, 101 Switching Protocols
2xx Success: the request was understood and answered 200 OK, 201 Created, 204 No Content
3xx Redirect: the resource sits somewhere else, the client should be forwarded 301, 302, 304, 307, 308
4xx Client error: the request is faulty or the resource is missing 400, 401, 403, 404, 410, 429
5xx Server error: the server cannot answer a valid request 500, 502, 503, 504

The first digit is enough for a rough classification: everything in the 2xx range is good, 3xx means redirect, 4xx and 5xx are errors. The second and third digit refine the statement inside the class.

The five classes of HTTP status codesHTTP status codes fall into five classes: 1xx informational, 2xx success, 3xx redirect, 4xx client error and 5xx server error. The first digit determines the class.5 classes: the first digit decides1xxInformationalRequest still in progress2xxSuccessPage delivered: 200 OK3xxRedirectResource has moved: 3014xxClient errorPage missing: 404, 4105xxServer errorServer overloaded: 503Fig. 2 · taismo
Fig. 2: The five classes of HTTP status codes. The first digit determines the meaning.

Which HTTP status codes matter for SEO?

For SEO, 7 status codes are especially relevant, because they directly control how Google crawls, rates and indexes a page. A wrong code can throw a whole page out of the index or waste link equity.

Code Meaning SEO relevance
200 OK: page delivered successfully Mandatory for every indexable page. Only 200 pages belong in the index.
301 Moved Permanently: permanent redirect Passes link equity to the target. First choice for URL changes and domain moves.
302 Found: temporary redirect Only for short-term redirects. Keeps the original URL in the index.
304 Not Modified: content unchanged Saves crawl resources, because Google uses the cached version.
404 Not Found: page does not exist Normal for deleted pages. Google drops 404 URLs from the index over time.
410 Gone: page permanently removed A clearer signal than 404. Google deindexes 410 URLs faster.
503 Service Unavailable: temporarily unreachable The right signal during maintenance. Google tries again later instead of deindexing.

Status code 200 is the normal case. Every page that is meant to rank has to return 200 when it is requested. If an important URL accidentally serves 404 or 500, it disappears from the search results.

During a move, the difference between 301 and 302 decides what happens to your link equity. A 301 redirect is permanent and transfers the ranking signals from the old URL to the new one. A 302 signals “only temporary” and leaves the old URL in the index. Replacing a URL for good but setting a 302 gives away visibility you have already built.

For deleted content, 404 and 410 are equally legitimate. 410 (Gone) is the more decisive signal and in practice often leads to faster deindexing. One thing matters: a deleted page must not quietly return 200 (a so-called soft 404), otherwise Google keeps treating it as valid.

For planned maintenance, 503 is mandatory. The code tells Google “come back later” and prevents a page that is briefly offline from being deindexed. If you want to keep a page out of the index with the robots.txt or the X-Robots-Tag instead of a status code, you are working on a different level: the status code controls availability, while robots.txt and the X-Robots-Tag control crawling and indexing.

How do you check HTTP status codes?

HTTP status codes can be read out directly with a handful of tools. For single URLs the browser is enough, for a whole website you need a crawler.

  • Browser developer tools: the “Network” tab shows the status code for every loaded resource. The fastest way for a single page.
  • Command line with curl: one command reads the headers together with the status code, ideal for following redirect chains.
  • Crawlers such as Screaming Frog: check thousands of URLs at once and list every 3xx, 4xx and 5xx code on a website.
  • Google Search Console: the “Pages” report shows which URLs Google crawled with which status and why they are not indexed.

On the command line, this curl command reads the headers only and follows every redirect on the way:

curl -sIL https://example.com/old-page/ | grep -i "^HTTP"

The output shows every stop of a chain, for example HTTP/1.1 301 followed by HTTP/1.1 200. Long redirect chains and accidental loops become visible immediately. A systematic check of all status codes is part of every technical SEO audit, because wrong codes are among the most common and at the same time most easily fixed crawling problems.

Frequently asked questions about HTTP status codes

What does status code 200 mean?
200 OK means that the request succeeded and the server delivers the page normally. Every page that is meant to enter the Google index has to return code 200 when it is requested.

Is a 404 error bad for SEO?
No, a 404 for pages that really have been deleted is normal and correct. It only becomes a problem when important or linked URLs return 404 by accident, because then visibility is lost.

What is the difference between 301 and 302?
301 is a permanent redirect and transfers link equity to the target page. 302 is temporary and keeps the original URL in the index. For permanent moves, 301 is the right choice.

Which status code applies during maintenance?
503 Service Unavailable is the correct code for planned maintenance. It tells Google that the page is only temporarily unreachable and prevents deindexing.

hreflang

What is hreflang?

hreflang is an HTML attribute that tells search engines the language and the geographic target region of a web page. The hreflang attribute connects pages with the same content across different languages, so that Google shows every user the matching language or country version in the search results. A German user lands on the German version, a US user on the English version of the same page.

hreflang attribute explained: the language signal for international SEO with the codes de-DE, en-US and x-default

The attribute is the central building block of international SEO. Without hreflang, Google decides for itself which language version to rank and may serve a German searcher the English page. hreflang controls that assignment actively.

The term at a glance

Feature Detail
Type HTML attribute of the link element
Pronunciation “href-lang”, from hyperlink reference language
Syllables href·lang
Related terms canonical, x-default, ISO 639-1, ISO 3166-1

How does the hreflang attribute work?

hreflang works through mutual references between language versions. Every page lists all of its language variants in a link element, including itself. A typical set of entries in the <head> looks like this:

<link rel="alternate" hreflang="de-DE" href="https://example.com/produkt/" />
<link rel="alternate" hreflang="en-US" href="https://example.com/en/product/" />
<link rel="alternate" hreflang="x-default" href="https://example.com/" />

The value is made of two parts: the language and, optionally, the country. de stands for German, de-AT for German in Austria. Google reads these entries, groups the pages as one unit and serves the right version for each query.

The most important rule: hreflang has to work both ways. If the German page points to the English one, the English page has to point back to the German one. Without that return link, Google ignores the entry completely.

hreflang return link: mutual reference between language versionsThe German page points to the English page through hreflang and the English page points back to the German one. Only this two-way return link is accepted by Google.German pagehreflang=”de-DE”example.com/produkt/English pagehreflang=”en-US”example.com/en/product/Mutual reference (return link)If the return link is missing, Google ignores the hreflang entry.Fig. 1 · taismo
Fig. 1: The two-way hreflang reference (return link) between the German and the English page.

Which language and country codes does hreflang use?

hreflang combines two international standards. The language code follows ISO 639-1 (two lowercase letters), the optional country code follows ISO 3166-1 alpha-2 (two uppercase letters).

  • Language only: hreflang="de" for all German-speaking regions.
  • Language and country: hreflang="de-CH" for German in Switzerland.
  • Country alone is not allowed: a country code never stands on its own, the language is mandatory.

One frequent mistake: hreflang="en-UK". The correct country code for the United Kingdom is GB, not UK. Google silently drops codes that are wrong.

What does hreflang=”x-default” mean?

x-default marks the fallback page for every user whose language or region has no version of its own. If someone from France visits a website without a French version, Google serves the page marked as x-default, often the English home page or a language selector.

x-default is optional, but recommended. The entry keeps Google from picking a random version for regions you do not cover.

Where is hreflang implemented?

There are 3 ways to implement hreflang. All three carry the same weight for Google, and you pick exactly one per website.

  1. In the HTML <head>: one link element per language version. Easy to set up, but with many pages and languages the source code grows large.
  2. In the HTTP header: useful for non-HTML files such as PDFs, where no <head> exists.
  3. In the XML sitemap: all connections maintained centrally in one place. Ideal for large websites with many languages, because the page source stays lean. The term sitemap explains more about that.
Three ways to implement hreflanghreflang can be implemented in three equally valid ways: in the HTML head, in the HTTP header or in the XML sitemap. Exactly one method is chosen per website.3 equally valid ways, exactly one per website1HTML <head>One link element perlanguage version.Simple, but verbose markup.2HTTP headerFor files without ahead, such as PDFs.Set on the server.3XML sitemapMaintained centrallyin one place.Ideal for large sites.Fig. 2 · taismo
Fig. 2: The three equally valid ways to implement hreflang. You pick exactly one per website.

Which hreflang errors are the most common?

hreflang has a reputation for being error-prone, because even small inconsistencies tip over the whole assignment. The 4 most common errors:

  1. Missing return link: the reference does not work both ways. Without a return link, Google discards the entire hreflang set of the page.
  2. No self-reference: every page has to list itself in hreflang as well. If the entry pointing to itself is missing, the set is incomplete.
  3. Wrong codes: en-UK instead of en-GB, or invented language abbreviations. Only valid ISO codes are recognized.
  4. Conflict with the canonical: if the canonical of a page points to a different language version, the signals contradict each other. The canonical of a page always has to point to itself, while hreflang points to the alternatives.

Google reports problems like these in Google Search Console. The former International Targeting report has been retired, but hreflang errors still show up in the coverage and inspection reports.

hreflang vs. canonical: what is the difference?

hreflang and the canonical link solve different jobs and complement each other.

  • The canonical defines the main version of URLs with identical content and prevents duplicate content. The canonical always points back to the page’s own URL.
  • hreflang shows Google the language alternatives of a page. hreflang does not turn several language versions into duplicates, it turns them into one connected group.

In short: the canonical says “this is the right URL for this content”, hreflang says “and here is the same content in other languages”. Together they keep multilingual websites clean, which is a core topic of any ongoing SEO support.

Frequently asked questions about hreflang

Does every multilingual website need hreflang?
Yes, as soon as the same content exists in several languages or for several countries. hreflang keeps Google from ranking the wrong version.

Is hreflang a ranking factor?
No, hreflang does not improve rankings directly. hreflang makes sure that the page that already ranks is served in the right language version, which strengthens user experience and click-through rate.

Does hreflang replace a translation?
No, hreflang only points to language versions that already exist. You have to create the actual translations separately, for example with a multilingual plugin.