.htaccess Generator
Create production-ready .htaccess rules — redirects, rewrites, security, caching, compression, auth, and more. Mobile-first UI.
Basic Actions
Toggle to include rules
Redirects (ordered)Supports 301/302, regex
Rewrite RulesCustom rewrite rules (advanced)
Error Pages & HeadersCustom error pages & headers
Caching & CompressionSet Expires headers & enable gzip
Password Protect (Basic Auth).htpasswd required — see notes
You must create a .htpasswd separately (use htpasswd or an online generator).
Live .htaccess PreviewGenerated rules below — copy or download
Preview updates automatically
Quick Examples & NotesTips
- Order matters: directives are applied top-to-bottom.
- Regex redirect: enable
Regexcheckbox in a redirect row and use patterns. - For Basic Auth, provide a correct server path to
.htpasswd. - Test on a staging server before deploying to production.