HTTP to HTTPS redirects: 301 or 308, and how many hops are too many
By TechCompare · Updated · How we check
Answer every HTTP request with a 301 or 308 to the same path on HTTPS. Keep the chain to one or two hops, and go to HTTPS on the same host before switching to www.
Old links, bookmarks and some apps still point at http:// addresses. The server should answer those with a permanent redirect to the HTTPS address. Do it in one hop where you can. Each extra hop is another round trip before the page starts loading, and long chains are where mistakes like redirect loops hide.
How this is calculated
301 and 308 both mean moved permanently, and browsers and search engines treat them that way. The difference is the request method. A 308 has to keep it, so a POST stays a POST. A 301 lets clients turn a POST into a GET, and most do. For ordinary page loads the two act the same. The temporary codes, 302 and 307, tell search engines to keep the old address, so they don't belong here.
Keep the path and the query. Sending http://example.com/pricing to the HTTPS home page breaks every old deep link and throws away the value of links to those pages.
Order matters when www is involved. http://example.com should go to https://example.com first, then to https://www.example.com if www is your main name. Jumping straight from http://example.com to https://www.example.com saves a hop, but then the bare domain never sets its HSTS header over HTTPS, and the preload list at hstspreload.org wants the first redirect to stay on the same host.
Watch for loops. A CDN that talks to your server over plain HTTP, while the server redirects everything to HTTPS, can bounce a request back and forth until the browser gives up with too many redirects.
The SSL Checker starts at http:// on your host and follows every redirect, listing each URL with its status code until something other than a redirect answers. It stops at a loop or a long chain and says why.
Verdict
Use one permanent redirect from HTTP to HTTPS on the same host, keeping the path and query, then at most one more hop to your main host name. Check the chain after any CDN or server change. A chain longer than two hops, or one that doesn't end on HTTPS, needs fixing.
More SSL scenarios
Related guides
Frequently asked questions
Should I use 301 or 308 for HTTPS redirects?
Does the redirect alone keep visitors safe?
Why does the checker show a different chain than my browser?
Related tools
DNS Lookup
Look up a domain's DNS records on Cloudflare or compare several resolvers at once, and read its SPF, DMARC and DKIM records in plain words.
Use toolOpen Graph Visualizer
Preview how your website links will look when shared on Google, Twitter, Facebook, and Discord.
Use toolPassword Generator
Generate secure, random passwords locally in your browser.
Use tool