Kavach

Fix · Apache

Fix “HTTP redirects to HTTPS” on Apache

Answer every http:// request with a 301 redirect to the https:// URL (and enable HSTS once that works).

<VirtualHost *:80>
  RewriteEngine On
  RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=301,L]
</VirtualHost>

Verify the fix

Re-run the HTTP redirects to HTTPS check after deploying. Test config changes in staging first and keep a rollback: a wrong header can break a site faster than a missing one.

Other stacks: nginx · Caddy · Express / Node · Cloudflare

Scan your site free → Monitor it continuously