Core Routing & Security Directives
.htaccess Configuration Output
# ========================================================
# Apache .htaccess Configuration
# Generated by MiniToolDesk (100% Client-Side)
# ========================================================
RewriteEngine On
# Force HTTPS Redirection
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Redirect www to non-www
RewriteCond %{HTTP_HOST} ^www\.(.+) [NC]
RewriteRule ^(.*)$ https://%1%{REQUEST_URI} [L,R=301]
# Disable Directory Browsing
Options -Indexes
# Custom 404 Error Page
ErrorDocument 404 /404.html
# Enable Gzip / Brotli Compression
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/json
</IfModule>
# Leverage Browser Caching (Expires Headers)
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType image/svg+xml "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/javascript "access plus 1 month"
</IfModule>
Pin this tool to your browser side panel
Access this utility anytime with Alt+M without switching tabs. 100% offline & free.
How to generate .htaccess files
- 1Toggle desired redirect and security options.
- 2Choose your preferred WWW domain canonicalization strategy.
- 3Copy or download .htaccess and place it in your web root.
Apache Web Routing
Standard mod_rewrite syntax compatible with shared hosts and VPS setups.
Frequently Asked Questions
Enjoying Apache .htaccess Generator?Help your engineering peers discover private, ad-free tools!
MiniToolDesk is 100% free and client-side. Your support keeps the web ad-free.
Related Developer Utilities
Popular
Docker Run to Compose Converter
Convert complex docker run CLI commands into clean, production-ready docker-compose.yml files
Launch toolβ
Popular
Nginx Config Generator
Visual builder for production-ready Nginx reverse proxy, SSL, and SPA configs
Launch toolβ
Popular
Dockerfile Multi-Stage Generator
Visual builder for security-hardened, multi-stage Dockerfiles across modern stacks
Launch toolβ
Popular
Kubernetes YAML Manifest Builder
Visual generator for Deployment, Service, Ingress, and ConfigMap manifests
Launch toolβ