Generate correct, ready-to-use Apache .htaccess snippets — HTTPS redirects, caching, compression and security headers — from a checklist, entirely offline.
A premium, zero-dependency
.htaccessworkbench for backend and hosting work. Flip on the rules you need — force HTTPS, canonical www/non-www, custom error pages, gzip/deflate compression, browser caching by file type, directory-listing lockdown, security headers, IP blocking — and get one combined, correctly-ordered.htaccessfile, ready to copy or download. Nothing is sent anywhere.
.htaccess Generator Pro is part of the Web Utility Suite. It runs entirely in the browser with no build step, no frameworks, and no network calls — open index.html from disk and it works. Each rule is a real Apache directive block (mod_rewrite, mod_deflate, mod_expires, mod_headers) written the way you'd hand-write it yourself, not fabricated syntax. Toggle rules on the left, watch the combined, syntax-highlighted .htaccess build live on the right.
- Force HTTPS redirect — a correct
mod_rewriteblock that 301-redirects any plain HTTP request to HTTPS. - www / non-www redirect — pick a direction (force
www.or strip it) and get the matchingRewriteCond/RewriteRulepair. - Custom error pages —
ErrorDocumentdirectives for 401, 403, 404 and 500, each with an editable path. - Gzip / Deflate compression — a
mod_deflateblock covering HTML, CSS, JS, JSON, XML, SVG and web fonts. - Browser caching headers — a
mod_expiresblock with independently configurable lifetimes for images, CSS/JS, web fonts and HTML. - Disable directory listing —
Options -Indexes. - Basic security headers —
mod_headersblock settingX-Frame-Options,X-Content-Type-Options,X-XSS-Protection,Referrer-Policyand an optional customContent-Security-Policy; untick any individual header you don't need. - Deny by IP — pick Apache 2.4 (
<RequireAll>/Require not ip) or Apache 2.2 (Order/Deny from) syntax, with the other version's equivalent included as a comment, for one or more IPs/CIDR ranges (one per line). - Live combined preview with syntax highlighting, line count, copy and Download
.htaccess. - Auto-persist — your rule selections and field values are saved to
localStorageand restored on return. - Dark & light themes, fully responsive down to 360px, accessible, keyboard-driven.
No dependencies, no build step.
git clone https://github.com/kasapdev/htaccess-generator-pro.git
cd htaccess-generator-proThen simply open index.html in any modern browser (double-click it, or file:// it). That's it.
- Flip on the rules you need in the left column — some reveal extra fields (redirect direction, error paths, cache durations, IPs to block).
- Watch the
.htaccesspreview panel on the right update live, combining every enabled rule into one correctly-ordered file. - Copy the result (Ctrl/⌘+C) or Download it directly as
.htaccess(Ctrl/⌘+S). - Drop the file into your site's root (or a subdirectory, for scoped rules) on any Apache server with the relevant modules enabled (
mod_rewrite,mod_deflate,mod_expires,mod_headers). - Reset restores the sensible defaults (compression, caching, no-indexing and security headers on).
| Action | Shortcut |
|---|---|
Copy .htaccess |
Ctrl/⌘ + C |
Download .htaccess |
Ctrl/⌘ + S |
| Show shortcuts help | ? |
| Close dialog | Esc |
Screenshots coming soon.
- Presets for common stacks (WordPress, static SPA, Laravel public/)
- Nginx-equivalent config export for side-by-side comparison
- HSTS header toggle with configurable max-age
- Rewrite rule tester against a sample URL
- Import an existing
.htaccessand pre-fill the checklist from it
MIT Licensed. Part of the Web Utility Suite.
One of 45+ zero-dependency vanilla JS tools, all free and open source — see the full list.