ratemysite.ai

How to force HTTPS and redirect HTTP with a 301

Every page should load over HTTPS, and every http:// address should redirect to its https:// twin with a permanent 301. Without this, browsers warn visitors, crawlers see two copies of each page, and signals split between them. Enable a certificate, add a site-wide redirect, and test it.

By . Updated .

How do you fix it?

  1. Enable a TLS certificate at your host or CDN; most hosts and Cloudflare issue one for free.
  2. Add a site-wide permanent redirect from http:// to https:// in your host settings, CDN rule or server config.
  3. Update internal links, canonical tags and the sitemap to use the https address.
  4. Run curl -I http://yourdomain.com and confirm the response is a 301 with a Location header that starts with https.
  5. Re-run the audit and confirm the HTTPS redirect check passes.

What is an HTTPS redirect?

An HTTPS redirect is a server rule that sends any request for an http:// address to the same page on https://, using a permanent status code. Browsers mark plain http pages as not secure, and Chrome has done so since 2018. Google has used HTTPS as a lightweight ranking signal since 2014. For crawlers, an unredirected http copy is a duplicate page, and it splits links between two addresses.

How do I test the redirect works everywhere?

Test the four variants: http and https, each with and without www. All four should end at one https address in a single hop. Use curl -I on each and read the status line and Location header. A chain of 3 or more redirects wastes crawl time and adds delay for visitors, so point the first redirect directly at the final address. Also check for mixed content, which is an https page that still loads images or scripts over http.

How much does this check matter?

What else do people ask?

Should I use a 301 or a 302 redirect?
Use 301 for a permanent move. A 302 tells crawlers the move is temporary, so they may keep the old http address in their index.
Will HTTPS slow my site down?
Not noticeably. Modern TLS adds a few milliseconds, and HTTPS enables HTTP/2 and HTTP/3, which often make pages faster overall.

Sources