.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
DirectiveDescription
Redirect 301Permanent redirect from one URL to another
Redirect 302Temporary redirect from one URL to another
RewriteEngine OnEnables the mod_rewrite engine
RewriteCondCondition that must be true for a RewriteRule to apply
RewriteRuleDefines the actual URL rewriting pattern and target
Header setSets an HTTP response header (requires mod_headers)
ErrorDocumentSpecifies a custom error page for an HTTP status code
ExpiresByTypeSets 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
Copied to clipboard!