.htaccess Generator
Toggle the options you need and get a ready-to-deploy .htaccess file for Apache. HTTPS redirects, caching, gzip, and more. Free, no sign-up.
Redirects
Redirect all HTTP traffic to HTTPS.
Redirect non-www to www.
Redirect www to non-www.
Performance
Compress HTML, CSS, JS, SVG, and other text files.
Set long cache expiry for static assets.
Security
Prevent directory contents from being listed.
Custom Error Pages
Serve a custom page for 404 errors.
Reference
What is .htaccess?
A .htaccess file (Hypertext Access) is a distributed configuration file for the Apache HTTP Server that applies settings on a per-directory basis — ideal when you lack access to the main server config, such as on shared hosting. Common uses include HTTPS redirects, URL rewriting, caching headers, and access control. See the official Apache .htaccess guide.
Required Apache modules
mod_rewrite — URL rewriting and conditional redirects. mod_deflate — GZIP compression for text responses. mod_expires — browser caching via Expires and Cache-Control headers. mod_headers — custom HTTP response headers. All are enabled by default on most shared hosting providers.
Privacy
All rules are generated 100% in your browser. Nothing is sent to any server.