Developer & Web Tools

.htaccess Snippet Generator

Generate Apache rules for HTTPS redirects, www handling, caching, compression and security headers.

Privacy

Everything on this page runs inside your browser. Nothing you paste, type or upload is transmitted, logged or stored.

Tips

  • Apply Strict-Transport-Security only once HTTPS is working everywhere. Browsers remember it for a year and will refuse plain HTTP.
  • Order matters: put redirect rules before caching and header blocks.
  • These directives are Apache-specific. On Nginx or IIS the equivalent configuration lives elsewhere.

Frequently asked questions

Nothing happens after I upload it. Why?

Most often AllowOverride is set to None in the server config, which makes Apache ignore .htaccess entirely, or the required module (mod_rewrite, mod_headers, mod_expires) is not enabled.

Related tools