.htaccess File Generator
Build a complete Apache .htaccess file — HTTPS redirects, caching, compression, and security headers — in one click.
Domain & Protocol
Performance
Security
Custom Error Pages
Custom Redirects
Misc & Platform
Always back up your existing .htaccess file before replacing it, and test on a staging site first. Some directives require specific Apache modules (mod_rewrite, mod_deflate, mod_expires, mod_headers) to be enabled on your server.
About this tool
The free .htaccess Generator lets you assemble a complete, production-ready Apache configuration file without memorizing rewrite syntax. Toggle the rules you need — force HTTPS, standardize on www or non-www, enable Gzip compression and browser caching, add security headers, block hotlinking, or set up custom 301 redirects — and the tool writes valid mod_rewrite, mod_headers, and mod_expires directives for you in real time.
This is especially useful when migrating a site, hardening a server after a security audit, or setting up a new WordPress install that needs clean permalinks. Every option includes a plain-language description, so you always know what a rule does before you add it to your live server.
How to use it
Check the boxes for the behaviors you want, fill in any required values (like your domain for www redirects, or custom error page paths), and copy or download the generated .htaccess file. Always back up your existing file first and test changes on staging before deploying to production.
