Academy / SEO

SEO

HTTPS: how to serve your whole site over a secure connection

By Fernando BalcázarReviewed on 5 min read

The essentials

  • Without HTTPS, browsers flag the page as “not secure” and many visitors leave.
  • Google uses HTTPS as a signal and prefers to index the secure version.
  • The http:// version must redirect to https:// with a 301, in a single hop.
  • A free certificate, such as Let’s Encrypt or Cloudflare, is enough for almost any site.

Why it matters

HTTPS encrypts the connection between the visitor and the server. For SEO it matters for three reasons: Google uses it as a signal, browsers warn without it, and forms, payments and browser features require it.

Redirecting http to https

Having the certificate is not enough: someone typing http://yoursite.com must land on the secure version. In nginx, for example:

nginx · http to https in one hop
server {
  listen 80;
  server_name yoursite.com www.yoursite.com;
  return 301 https://yoursite.com$request_uri;
}

With Cloudflare, the “Always Use HTTPS” setting does the same at the edge. On managed hosting it is usually a switch in the panel.

Mixed content

It happens when a secure page loads images, scripts or styles over http://. The browser blocks them or shows a warning. Search the source for src="http:// and href="http:// and change them to https:// or relative paths.

When moving to HTTPS

  1. Install the certificate and check every page loads over https.
  2. Turn on the 301 from http to https, in a single hop. More in 301 and 302 redirects: how to keep them to a single hop.
  3. Update canonicals, the sitemap and internal links to https.
  4. Add the https property in Search Console if you do not use a domain property.

Check it

Check whether your page uses HTTPS

ToolURL auditor →