← All Tools

.htaccess Generator

Visually build Apache .htaccess rules for redirects, caching, security, and more. Everything runs locally in your browser.

Presets

Redirects & Rewrites
Force HTTPS
Redirect all HTTP requests to HTTPS
WWW Redirect
Force or remove www prefix
Custom Error Pages
Set custom pages for HTTP error codes
URL Redirects
Add 301/302 redirect rules
Rewrite Rules
Custom mod_rewrite rules
Performance
Enable Gzip Compression
Compress HTML, CSS, JS, XML, and fonts
Browser Caching
Set Cache-Control headers for static assets
Security
Security Headers
X-Frame-Options, X-Content-Type-Options, X-XSS-Protection, Referrer-Policy, Permissions-Policy
CORS Headers
Access-Control-Allow-Origin header
Block Hotlinking
Prevent other sites from embedding your images
Block Bad Bots
Block known malicious user agents
Disable Directory Listing
Prevent browsing of directory contents
Password Protection
Require htpasswd authentication
IP Blocking
Deny access from specific IP addresses
Generated .htaccess
Copied to clipboard!