Apache .htaccess Generator

100% Client-Side Private

Production-ready rewrite rules for HTTPS, WWW canonicalization, and caching

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.

Get Extension

How to generate .htaccess files

  1. 1Toggle desired redirect and security options.
  2. 2Choose your preferred WWW domain canonicalization strategy.
  3. 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