.htaccess Generator
Assemble common Apache .htaccess rules — HTTPS and www redirects, caching, compression, security headers and more — in a click. Free, in your browser.
About .htaccess Generator
The .htaccess generator assembles battle-tested Apache configuration snippets into one file. Toggle on what you need: force HTTPS, canonical www or non-www redirects, disabled directory listings, custom 404/500 error pages, Gzip compression via mod_deflate, browser caching with Expires headers, security headers, hotlink protection, IP blocking, default index files and forced file downloads by extension.
Each option is a documented block, so the resulting file stays readable and easy to prune later. Redirect rules use your actual domain, which you enter once, and the security-header set applies common hardening responses without breaking normal pages.
The generator runs entirely in your browser — nothing is uploaded. Copy the output or download .htaccess, but always back up your existing file first: a single wrong directive can take a whole Apache site offline.
How to use .htaccess Generator
- Enter your domain so the redirect rules are generated for the right host.
- Toggle on the rules you need: HTTPS redirect, www or non-www, directory listing off, error pages, compression, caching, security headers, hotlink protection, IP blocking, index files or forced downloads.
- Fill in the per-option fields, such as the 404/500 page paths or the IP addresses to block.
- Review the assembled file in the output panel.
- Copy it or download .htaccess, back up your current file, then upload the new one to your site root.