By SitemapFixer Team
Updated April 2026

HSTS & SEO: How HTTP Strict Transport Security Affects Your Site

Check your HTTPS configuration and other technical SEO issues in one free scan.Analyze My Site Free

HTTP Strict Transport Security (HSTS) is a web security policy mechanism that instructs browsers to always connect to your site over HTTPS, even if a user types http://. For SEO, HSTS removes the performance overhead of HTTP-to-HTTPS redirects and strengthens the HTTPS signal that Google uses as a ranking factor. Understanding HSTS — its benefits, risks, and correct implementation — is essential for any site that has migrated to HTTPS or is planning to.

What Is HSTS?

HSTS is a response header: Strict-Transport-Security: max-age=31536000; includeSubDomains; preload. When a browser receives this header over an HTTPS connection, it stores a record that the domain must always be accessed via HTTPS for the duration of the max-age value (in seconds). Subsequent visits bypass the HTTP-to-HTTPS redirect entirely — the browser upgrades the connection internally before sending any network request. This eliminates the latency of a 301 redirect on first byte and prevents certain man-in-the-middle attacks that can intercept the initial HTTP request before the redirect fires.

HSTS and SEO: The Direct Benefits

Google confirmed HTTPS as a ranking signal in 2014 and has consistently expanded its weight. HSTS strengthens HTTPS adoption by ensuring no HTTP connections occur, which prevents mixed content scenarios where HTTP subresources load on HTTPS pages. Mixed content causes browser warnings that increase bounce rates. HSTS also eliminates the extra round trip of a 301 redirect for return visitors, improving page load times — a Core Web Vitals factor. Additionally, sites enrolled in the HSTS preload list signal a higher level of security commitment, though preload itself is not a direct ranking signal.

The HSTS Preload List

Beyond the response header, Google maintains an HSTS preload list that major browsers (Chrome, Firefox, Safari, Edge) hardcode into their source code. Sites on this list are loaded as HTTPS-only before the browser even makes a first connection — no HTTP request is ever attempted, not even the first one that would deliver the HSTS header. Submitting to the preload list at hstspreload.org requires setting a specific header: max-age of at least 31,536,000 (one year), includeSubDomains, and the preload directive. Inclusion is permanent and very difficult to reverse, so only submit if every subdomain is HTTPS-ready.

Risks of Incorrect HSTS Implementation

HSTS carries real risks if implemented incorrectly. If your SSL certificate expires and you cannot renew it, browsers with HSTS cached will refuse to connect to your site — there is no "click past" warning the way there is for a normal certificate error. If you set includeSubDomains before ensuring all subdomains have valid HTTPS, those subdomains become inaccessible. The preload list is particularly dangerous: removal takes months and requires clearing from all browser databases. Best practice: start with a short max-age (300 seconds), test thoroughly, then increase incrementally to one year before considering preload submission.

How to Implement HSTS on Your Server

To implement HSTS on Apache, add to your HTTPS VirtualHost or .htaccess: Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains". On Nginx, add inside the HTTPS server block: add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;. The always directive in Nginx ensures the header is sent on all responses, including error pages. For Cloudflare users, HSTS can be enabled under SSL/TLS > Edge Certificates > HTTP Strict Transport Security. Verify the header is present using Chrome DevTools > Network tab > inspect the response headers of any HTTPS page.

HSTS and HTTP-to-HTTPS Redirects for SEO

Even with HSTS in place, you should maintain 301 redirects from HTTP to HTTPS for new users and crawlers that have not cached your HSTS policy. Googlebot does not follow HSTS caching the same way browsers do — it may still attempt HTTP URLs and rely on your 301 redirects to reach HTTPS pages. Ensure every HTTP URL returns a 301 (not 302) to the HTTPS equivalent. A 302 temporary redirect does not pass full link equity. Also confirm that your canonical tags on all pages reference the HTTPS version, and that your XML sitemap contains only HTTPS URLs. Check Search Console's Coverage report for any HTTP URLs appearing as indexed.

Verifying HSTS Is Working Correctly

Use SecurityHeaders.com to scan your domain and grade your HSTS header configuration. Chrome DevTools' Application tab > Frames shows the HSTS status for your domain. You can also use the command line: curl -I https://yourdomain.com and look for the Strict-Transport-Security header in the output. To verify preload status, visit hstspreload.org and enter your domain. For SEO verification, run Screaming Frog after implementing HSTS and confirm all internal links use HTTPS — any remaining HTTP internal links waste redirect budget and dilute link equity through unnecessary hops.

HSTS vs. Automatic HTTPS Rewrites

Cloudflare's "Automatic HTTPS Rewrites" feature upgrades HTTP resource URLs in your page HTML to HTTPS, preventing mixed content warnings even before you update your own code. This is complementary to HSTS, not a replacement. HSTS protects at the connection level (browser-to-server), while automatic rewrites protect at the resource level (inline links and scripts). Both should be enabled for maximum protection. If you rely solely on automatic rewrites without HSTS, an HTTP page navigation can still occur before the rewrite activates, exposing users to potential downgrade attacks on the initial connection.

HSTS and Site Migrations

When migrating from HTTP to HTTPS, implement HSTS only after the migration is fully stable — typically two to four weeks after launch. This gives you time to identify and fix any certificate issues, mixed content problems, or pages that inadvertently serve HTTP. The migration sequence: (1) obtain and install SSL certificate, (2) configure 301 redirects from HTTP to HTTPS, (3) update canonical tags and sitemaps to HTTPS, (4) update Google Search Console properties to the HTTPS version, (5) verify no mixed content warnings, (6) implement HSTS with a short max-age, (7) extend max-age over time as confidence grows, (8) consider preload submission only when fully committed.

Audit Your HTTPS Configuration and SEO Health
Free analysis in 60 seconds
Analyze My Site Free

Related Guides