Guides · HTTPS and certificate

HTTP to HTTPS redirect

One of the checks in every audibot report. This page says exactly what audibot reads, what passes, and how to fix it.

What audibot checks

A GET of http://<host>/ without following redirects. It must answer with a 3xx status whose Location header starts with https://.

Why it matters

People type addresses without a scheme and old links point to http://. Without a redirect they either get the insecure version of the site or nothing.

How do I redirect HTTP to HTTPS?

Answer every plain-HTTP request with a 301 to the same host and path on https://. Use an absolute https:// URL in Location.

nginx

server {
    listen 80;
    listen [::]:80;
    server_name example.com www.example.com;
    return 301 https://$host$request_uri;
}

Apache (port 80 virtual host)

<VirtualHost *:80>
    ServerName example.com
    Redirect permanent / https://example.com/
</VirtualHost>

Caddy

Automatic for any site with a domain name; no configuration needed.

Cloudflare

SSL/TLS → Edge Certificates → Always Use HTTPS → On

Related tools

Other checks in HTTPS and certificate

HTTPS and certificate in the methodology ·All guides

This check is one step of the website launch checklist.

Check your site

audibot runs this check and every other one in a single audit, and publishes the report with a recommendation for each finding.