.htaccess Generator

Generate Apache .htaccess files with redirect rules, caching, security headers, and gzip compression.

Build a complete Apache .htaccess configuration file with a visual form. Add URL redirect rules (301/302), browser caching by file type, security headers like X-Frame-Options, Content-Security-Policy and HSTS, and enable gzip compression. The generated file is ready to drop into your Apache web root.

Redirect Rules
Browser Caching
Security Headers
Compression
.htaccessDONE
734 chars22 lines

Related Tools

FAQ

What is an .htaccess file?
An .htaccess file is a directory-level configuration file used by the Apache web server. It lets you override server settings for a specific directory without editing the main server configuration, enabling redirects, caching rules, and security policies.
Will this work on Nginx?
No. .htaccess is an Apache-specific feature. For Nginx, use the nginx-redirect-generator tool instead. Some shared hosting providers also support .htaccess even if they run Nginx under the hood via a compatibility layer.
What is HSTS and should I enable it?
HTTP Strict Transport Security (HSTS) tells browsers to only connect to your site over HTTPS for a set duration. Once enabled, browsers will refuse plain HTTP connections. Only enable it when your site is fully HTTPS and you are confident you will not revert to HTTP.