Free Apache Config Builder

Generate Your.htaccess File

Build a production-ready Apache .htaccess configuration in seconds. Toggle rules on or off, add custom redirects, and copy the result — no Apache expertise needed.

🔒

HTTPS & Redirects

Force HTTPS, add or remove www, and create 301/302 redirect rules for any path.

Performance Rules

Enable gzip compression and set browser caching expiry for images, CSS, and JS.

🛡️

Security Hardening

Add X-Frame-Options, block bad bots, enable hotlink protection, and disable directory listing.

HTTPS & Domain

Force HTTPS
Redirect all HTTP traffic to HTTPS (301)
WWW Redirect
Disable Directory Listing
Hide folder contents — prevents visitors from browsing files

Error Pages

Custom Error Pages
Set custom HTML paths for 4xx and 5xx errors

.htaccess Output

.htaccess
# Generated by htaccess-generator.tools.jagodana.com
# .htaccess Configuration File

# Disable directory listing
Options -Indexes

# Force HTTPS
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# Gzip Compression
<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css
  AddOutputFilterByType DEFLATE text/javascript application/javascript application/x-javascript
  AddOutputFilterByType DEFLATE application/json application/xml application/xhtml+xml
  AddOutputFilterByType DEFLATE image/svg+xml application/rss+xml
</IfModule>

# Browser Caching
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType image/jpeg "access plus 1 year"
  ExpiresByType image/png "access plus 1 year"
  ExpiresByType image/webp "access plus 1 year"
  ExpiresByType image/gif "access plus 1 year"
  ExpiresByType image/svg+xml "access plus 1 year"
  ExpiresByType image/x-icon "access plus 1 year"
  ExpiresByType text/css "access plus 1 month"
  ExpiresByType text/javascript "access plus 1 month"
  ExpiresByType application/javascript "access plus 1 month"
  ExpiresByType application/pdf "access plus 1 month"
  ExpiresByType text/html "access plus 0 seconds"
</IfModule>

# Security Headers
<IfModule mod_headers.c>
  Header always set X-Frame-Options "SAMEORIGIN"
  Header always set X-Content-Type-Options "nosniff"
  Header always set Referrer-Policy "strict-origin-when-cross-origin"
</IfModule>

All rules are generated in your browser. Nothing is sent to a server.

Frequently Asked Questions

Everything you need to know about .htaccess Generator.