Glossary Web & HTTP

Redirect

A redirect is a server response that sends the browser to a different URL, using a 3xx status code and a Location header.

Last reviewed:

AdSense Placeholder
Slot: header_reference_page

In more detail

A 301 or 308 says a page has moved permanently, so browsers and search engines should update their links; a 302 or 307 says the move is temporary. The browser reads the Location header and requests the new address. With 301 and 302 a browser may turn a POST into a GET; 307 and 308 guarantee the method and body are kept. Redirects can also be made in the page itself (a meta refresh or JavaScript), but those are slower and less clearly understood by search engines.

Why it matters

Browsers cache 301 responses aggressively, so a mistaken permanent redirect can stick in visitors' browsers long after you remove it. A redirect that points back to itself ends in a "too many redirects" error. A login page that redirects to any address passed in a parameter (an open redirect) is a gift to phishers. Chains of several redirects slow pages down and should be kept short.

Example

GET /old-page HTTP/1.1
Host: example.com

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

Use redirects when you change URLs, switch to HTTPS or consolidate www and non-www names. A chain such as http://example.com → https://example.com → https://www.example.com/ takes two hops; pointing the first straight at the final address saves one.

AdSense Placeholder
Slot: footer_leaderboard