Skip to content

Redirecting http to https

Updated 16 November 2026

What's the difference between http and https?

The address starts with one or the other. HTTPS is an encrypted version of the HTTP protocol, and MDN says it uses TLS to encrypt all communication between a client and a server1. In plain terms, the "s" means the conversation between the visitor's browser and your site is scrambled on the way.

Your site can be reached at both http:// and https:// addresses until you do something about it. To a search engine and to a browser, those are two different addresses.

Why do I need a redirect for it?

Because people still arrive at the old kind of address. They have old bookmarks. They type your name without the prefix. Links on other sites use http://.

The fix is a redirect. MDN lists forcing HTTPS as a use case: requests to the http:// version of your site redirect to the https:// version2. Google says the same thing from a search point of view. If your page can be reached through several addresses, pick one as the preferred (canonical) address and use redirects to send traffic from the others to it3.

A visitor typing the plain http addressVisitor opens the http addressServer says: use https insteadBrowser asks for the https addressSecure page loads
The redirect moves them to the secure version.

Which redirect type should it be?

A permanent one, in most cases, since the plain http address isn't coming back. Google ties permanent redirects to cases where you're sure you won't undo them3. The permanent and temporary types are explained elsewhere on this site.

One thing to check after you set it up is that the destination is the real secure address of the same page. A rule that sends every plain address to the home page throws away the page the visitor wanted. The rebuild page has more on why that goes wrong.

Do I set this up myself?

It depends on where your site lives. Many hosts and website platforms have a setting for it, and that setting is the safest place to start. Read the maker's own help pages for the exact name and steps, since they differ and change. This site doesn't recommend any host.

If you run your own server and edit its settings, MDN shows examples for Apache and Nginx in its guide to redirections2. Follow the documentation for your server's version, and keep a copy of the file before you change it.

The aim is one rule, not several. MDN says redirect use should be kept to a minimum2. A tangle of extra rules is how you end up with chains and loops.

What is HSTS, and do I need it?

HSTS stands for HTTP Strict Transport Security. It's a header your server sends. MDN says it informs browsers that the host should only be accessed using HTTPS. Any future attempts to access it using HTTP should automatically be upgraded to HTTPS4.

It builds on the redirect and doesn't replace it. MDN says HSTS does not take effect until the browser has made at least one secure connection to the host and received the header4. So the first visit still needs the redirect.

There's a rule about where the header goes. MDN says the redirect must not include the Strict-Transport-Security header, since the request used insecure HTTP. The header has to come from the HTTPS response after the redirect4.

How HSTS comes in after the redirectFirst visit uses the redirectSecure reply carries the HSTS headerBrowser remembers the hostLater visits go straight to https
The browser remembers and skips the first step next time.

HSTS has settings, including how long the browser should remember. MDN says that if a later response leaves the header out, the previous header remains in effect until its expiration time4. So a wrong setting can linger. Read MDN's page and your host's own documentation before turning it on. It's optional for a small site, and the redirect alone does the basic job.

Do I need to tell Google I've switched?

Google says no, for this case. Its site-move guide says you only need the Change of Address tool when moving from one domain or subdomain to another. You don't need it for HTTP to HTTPS moves5.

What if the secure version doesn't load?

Then don't switch the redirect on yet. A redirect to an address that gives an error is worse than no redirect. Open the https:// address by hand first. If it loads properly, add the redirect, and then check where it goes.

If you see a "too many redirects" message after the change, the chains and loops page covers what's usually behind it.

Further reading and sources

  1. HTTPS (glossary), MDN Web Docs (Mozilla)
  2. Redirections in HTTP, MDN Web Docs (Mozilla)
  3. Redirects and Google Search, Google Search Central
  4. Strict-Transport-Security header, MDN Web Docs (Mozilla)
  5. Site moves with URL changes, Google Search Central