Technical

HTTP 301

Also called Moved Permanently.

HTTP 301 is the status code for a permanent redirect. It tells clients and search engines that a resource has moved for good and that the `Location` header holds the new address.

How it is measured

`curl -I http://example.com/old` prints `HTTP/1.1 301 Moved Permanently` and a `Location: https://example.com/new` line. Add `-L` to follow the chain and count the hops.

Browsers cache a 301 with no expiry unless told otherwise, so use a private window to see a change. Search engines transfer ranking signals to the new URL over time, not instantly.

Worked example

A bike store replaces `/products?id=88` with `/frames/aero-88`. Its old URLs hold 1,200 inbound links from other sites. A 301 map goes live on Tuesday, and by day 10 Search Console shows the new URL indexed for 71 of the top 80 pages.

One rule sent everything to the homepage instead of the matching page. Those 9 pages lost their positions until the rules were changed to one-to-one.

How it differs

An HTTP 301 says the move is permanent. An HTTP 302 says it is temporary and the original address should stay. Both send the browser on with `Location`. The 301 asks clients to remember and update, and the 302 asks them to come back and ask again.

Common errors

Using a 301 for a short promotion and getting it cached for months. Building chains four hops long. Creating loops. Redirecting every dead URL to the homepage. Dropping the path or query string on the way. Leaving http-to-https and www-to-bare as two separate hops.

In practice

Keep a one-to-one map of old to new, test it with `curl -IL`, and make each redirect a single hop. Leave the rule in place for at least a year. Update internal links to the new address so they stop depending on the redirect.

See also

HTTP 302, Canonical URL

Sources

Count this on a real site.

Watch my website