Back to Glossary
SEO

Redirect

A redirect is a technique that automatically forwards a request made to one URL to a different URL. It is implemented through server response codes (301, 302, 307, 308), HTML meta tags, or JavaScript, and signals search engines and browsers whether the move is permanent or temporary.

  • A redirect automatically forwards a request from one URL to another, and can be implemented in three ways: a server response (3xx), a meta tag, or JavaScript.
  • Permanent redirects (301, 308) signal that the new URL should be indexed as the canonical address, while temporary redirects (302, 307) keep the original URL in place.
  • With 301 and 302, the HTTP method may switch to GET on non-GET requests, whereas 308 and 307 preserve the method and request body exactly.
  • For reliability, Google recommends server redirects first, then meta refresh, then JavaScript.
  • Mixing several methods risks infinite loops, so consolidating on a single server-side redirect is the safer choice.

Redirect Basics

A redirect is a technique that automatically passes a URL requested by a user or crawler on to a different URL. It is used when a page address has changed, when migrating from http to https, or when consolidating several variant URLs into one canonical address. When the receiving server or page indicates "go to that address instead of this one," the browser and search engine follow that instruction and move to the destination.

Redirects fall into two broad categories: permanent and temporary. A permanent redirect means the content has been fully moved to a new location, while a temporary redirect means the move is only momentary. This distinction matters in SEO because, when a search engine receives a permanent signal, it treats the new URL as the canonical address for indexing, whereas with a temporary signal it keeps the original URL in the index.

Implementation Methods

A redirect can be implemented at three layers, each with a different execution priority and level of reliability.

  • Server-side redirect (HTTP 3xx): The server returns a 3xx status code along with a Location header. This is the fastest method, applies to every type of resource, and is the most reliable for SEO.
  • Meta refresh: Handled with a <meta http-equiv="Refresh"> tag inside the HTML <head>. It works only on HTML documents, and for accessibility the delay should always be set to 0.
  • JavaScript redirect: Navigates using window.location. Conditional branching is possible, but because of the risk of rendering failures, Google recommends it only as a last resort.

Status Code Comparison

The crux of a server redirect is which 3xx code you use. They divide as follows according to the permanent/temporary distinction and whether the HTTP method is preserved.

CodeNameNatureMethod HandlingPrimary Use
301Moved PermanentlyPermanentGET preserved; non-GET may switch to GETSite structure changes, permanent page moves
308Permanent RedirectPermanentMethod and body preserved as-isPermanent moves involving non-GET actions (e.g., POST)
302FoundTemporaryGET preserved; non-GET may switch to GETTemporarily changing a page's location
307Temporary RedirectTemporaryMethod and body preserved as-isTemporary moves involving non-GET actions
303See OtherTemporarySwitches to GET (body lost)Moving to a result page after processing a POST/PUT

According to MDN, 301 and 302 were specified with the intent of not changing the method, but in practice some clients ambiguously turned POST/PUT/DELETE into GET; 308 and 307 were introduced to remove this ambiguity and strictly preserve the method and body.

Implementation Examples

Examples of server-side permanent redirects across different environments.

HTTP/1.1 301 Moved Permanently
Location: https://www.example.com/new-page/
# Nginx — http to https + non-www to www consolidation (permanent)
server {
    listen 80;
    server_name example.com www.example.com;
    return 301 https://www.example.com$request_uri;
}
# Apache .htaccess — permanent move of a single path
Redirect 301 /old-page/ https://www.example.com/new-page/
<!-- Meta refresh: only when a server redirect is impossible, with delay 0 -->
<head>
  <meta http-equiv="Refresh" content="0; URL=https://example.com/new-page/" />
</head>

SEO Best Practices

Recommendations grounded in the official Google Search Central documentation.

  • Use 301 or 308 for permanent moves. Google interprets these as a signal to treat the new URL as the canonical address and surfaces the new URL in search results.
  • Use 302 or 307 for temporary changes. With a temporary redirect, the indexing pipeline does not treat the target URL as canonical and keeps the original URL in search results.
  • Choose server-side as the primary method. The priority Google specifies is server redirect > meta refresh > JavaScript > crypto redirect, and JavaScript should be used only when both the server and meta approaches are impossible.
  • Do not stack multiple methods. MDN warns that placing an HTTP redirect and an HTML meta redirect together can cause problems such as infinite loops when only one of them is updated.
  • Use 308 or 307 for endpoints tied to non-GET actions. Since a request like POST can break if its method switches to GET, choose a method-preserving code.

References and Sources

Related terms