Skip to content

PHP security updates released 21 October 2026. The flaws are now being actively exploited, so check your website's PHP is up to date. Patches are available for older PHP versions too. What it means for your website

HSTS

What is HSTS? Strict-Transport-Security explained

HSTS tells browsers to use only the encrypted version of your website. It closes a gap that an HTTPS redirect can't, but it needs turning on with care.
Published 4 November 2026 · Last updated 4 November 2026 · By Host Dada

The gap a redirect leaves open

Most websites redirect http:// to https://, and they should. But the redirect itself happens over an unencrypted connection. When someone types your address without https://, or follows an old link, that first request can be seen and altered by anyone in a position to interfere, such as whoever controls a dishonest public Wi-Fi network. They could keep the visitor on an unencrypted copy of your site without the redirect ever reaching them. This is called an SSL stripping attack.

How HSTS closes it

When a browser receives this header over HTTPS, it remembers your domain:

Strict-Transport-Security: max-age=31536000

For the next max-age seconds (a year, in this example), that browser:

  • changes any http:// address for your site to https:// before sending anything, so there's no unencrypted first request to interfere with;
  • refuses to let the visitor click through a certificate warning on your site, so a forged certificate can't simply be accepted.

Browsers ignore the header if it arrives over plain HTTP, since an attacker could have added it. Note the limit: the protection starts after a browser's first secure visit, unless your domain is on the preload list described below.

The three settings

  • max-age is how long browsers remember the rule, in seconds. It's required. 15552000 is six months and 31536000 is a year. Setting max-age=0 tells browsers to forget the rule.
  • includeSubDomains applies the rule to every subdomain as well. Check all of them first, including anything rarely visited such as a webmail, staging or old campaign address. If one can't do HTTPS, it becomes unreachable for anyone whose browser has the rule.
  • preload signals that you want your domain included in the HSTS preload list, which is built into browsers, so that even a first visit is protected. Its requirements include a max-age of at least a year, with includeSubDomains and preload, on your main domain. Removal can take a long time to reach everyone, so it isn't a step to take casually.

How to turn it on safely

The risk with HSTS is that it does what it says. While the rule is in place, a browser that remembers it won't fall back to HTTP, and visitors can't click past a certificate error. If your certificate lapses, your site is unavailable to them until it's fixed. Work up to it in stages:

  1. Confirm HTTPS works everywhere: every page and every version of your domain, with and without www. Make sure the certificate renews automatically and that you know who is responsible for it.
  2. Start small with max-age=300 (five minutes), then check the site still behaves.
  3. Increase in steps: a day (86400), then a week (604800), then a month (2592000), leaving time between each.
  4. Settle on at least six months. Many sites use a year.
  5. Consider includeSubDomains and preloading last, and only after checking every subdomain.

Set it at server level, or in your CDN if you use one. On Apache and nginx, that looks like this:

# Apache
Header always set Strict-Transport-Security "max-age=31536000"

# nginx
add_header Strict-Transport-Security "max-age=31536000" always;

What our checker reports

We read the header from your home page response, and only when that page was reached over HTTPS:

  • Set: a max-age of 15552000 seconds (six months) or more.
  • Short duration, Disabled or Invalid: flagged for attention when the value is under six months, is max-age=0, or can't be read.
  • Not set: flagged for attention, as a recommendation. It doesn't mean your site has been compromised.

We don't assess includeSubDomains or preload, and we don't look up the preload list. The check tests your HTTP-to-HTTPS redirect and certificate separately. HSTS is one of the five protections in our security headers guide.

Common questions

If I have HSTS, do I still need a redirect from HTTP to HTTPS?
Yes. A browser only learns the HSTS rule from a secure visit, so first-time visitors and browsers whose rule has expired still rely on the redirect to reach the secure site.
How do I undo HSTS?
Serve the header with max-age=0 over HTTPS. Each browser only forgets the rule the next time it visits, so you need to keep working HTTPS in place until the old max-age has passed. If your domain is on the preload list, removal is a separate request and takes much longer.
Is six months a rule or a recommendation?
It's a recommendation, and the line our checker uses. The HSTS standard doesn't set a minimum. Short values simply leave longer gaps for visitors who don't return often.

Run the free check

Check your website now. It's free, needs no account and takes a few seconds. You can read exactly how the check works and what it can't see, or find out more about the Security Checker on hostdada.co.uk.

Check your website now

Free, passive and takes a few seconds. No account needed.

Check My Website — Free