.htaccess Generator
Generate .htaccess rules for redirects, rewrites, security headers, and caching.
100% private — runs entirely in your browser
Quick Presets
Redirects
URL Rewriting
Security Headers
Browser Caching
Custom Error Pages
404
403
500
Generated .htaccess
| Directive | Description |
|---|---|
Redirect 301 | Permanent redirect from one URL to another |
Redirect 302 | Temporary redirect from one URL to another |
RewriteEngine On | Enables the mod_rewrite engine |
RewriteCond | Condition that must be true for a RewriteRule to apply |
RewriteRule | Defines the actual URL rewriting pattern and target |
Header set | Sets an HTTP response header (requires mod_headers) |
ErrorDocument | Specifies a custom error page for an HTTP status code |
ExpiresByType | Sets cache expiry for a specific MIME type (requires mod_expires) |
RewriteBase / | Sets the base URL for per-directory rewrites |
%{HTTPS} | Server variable — "on" if HTTPS is active |
%{HTTP_HOST} | Server variable — the requested hostname |
[L,R=301] | Flags: L = last rule, R=301 = permanent redirect |