.htaccess File Generator (Apache Rules)
Network & WebmasterGenerate Apache .htaccess rules for HTTPS redirection, WWW prefix preferences, custom 404s, and GZIP.
Server Directives & Options
Generated .htaccess Code
# ToolsApp .htaccess Configuration File
RewriteEngine On
# 1. Force HTTPS Redirect
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# 2. Force www Prefix
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]
# 3. Disable Directory Browsing (Security)
Options -Indexes
# 4. Custom 404 Error Page
ErrorDocument 404 /404.html
# 6. Gzip / Deflate Compression
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css
AddOutputFilterByType DEFLATE application/javascript application/json application/xml
AddOutputFilterByType DEFLATE font/ttf font/otf font/x-woff image/svg+xml
</IfModule>
How to Use .htaccess File Generator (Apache Rules)
1
Configure Options
Toggle HTTPS redirect, WWW preference, and Gzip compression.
2
Download .htaccess
Download or copy your generated server configuration.
Privacy Guarantee:All computations, transformations, and file processing occur 100% locally in your browser via client-side JavaScript. Your sensitive data is never uploaded or logged on any remote server.