htaccess Generator - Free Online Apache Config Tool | IconVault

Build a production .htaccess visually: HTTPS and www redirects, gzip, browser caching, security headers, error pages, rewrites. Free.

All tools

htaccess Generator

Build production .htaccess files visually with live preview

5 of 5 free uses left

Redirects

Force HTTPS

301 redirect http to https

Performance

Gzip compression

mod_deflate for text, CSS, JS, SVG

Browser caching

Expires headers for assets

Security

Security headers

nosniff, SAMEORIGIN, CSP and more

Disable directory listing

Hotlink protection

Block image embeds on other sites

5 of 5 free generations left - runs fully in your browser, nothing is uploaded.

Live preview: .htaccess

# Generated by IconVault htaccess Generator

<IfModule mod_rewrite.c>
  RewriteEngine On

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

  RewriteRule ^old-page/?$ /new-page [L,R=301]

</IfModule>

# Gzip compression
<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/json application/xml image/svg+xml
</IfModule>

# Browser caching
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType image/jpg "access plus 1 month"
  ExpiresByType image/jpeg "access plus 1 month"
  ExpiresByType image/png "access plus 1 month"
  ExpiresByType image/gif "access plus 1 month"
  ExpiresByType image/webp "access plus 1 month"
  ExpiresByType image/svg+xml "access plus 1 month"
  ExpiresByType text/css "access plus 1 month"
  ExpiresByType application/javascript "access plus 1 month"
  ExpiresByType font/woff2 "access plus 1 year"
  ExpiresDefault "access plus 1 week"
</IfModule>

# Security headers
<IfModule mod_headers.c>
  Header always set X-Content-Type-Options "nosniff"
  Header always set X-Frame-Options "SAMEORIGIN"
  Header always set Referrer-Policy "strict-origin-when-cross-origin"
  Header always set Permissions-Policy "camera=(), microphone=(), geolocation=()"
  Header always set Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; font-src 'self' data:"
</IfModule>

# Disable directory listing
Options -Indexes

# Custom error pages
ErrorDocument 404 /404.html
ErrorDocument 500 /500.html

Every block is wrapped in IfModule checks, so missing Apache modules will not break your site. Upload to your web root as .htaccess.

About this tool

IconVault's htaccess Generator builds a complete, production-ready .htaccess file through toggles instead of memorized Apache syntax. Turn on HTTPS redirects, www to non-www (or the reverse), gzip compression, browser caching with Expires headers for assets, security headers like HSTS and X-Frame-Options, custom error pages, directory listing control, hotlink protection for images and your own rewrite rules, with a live preview of the file as you configure it.

Copy the result or download it straight to your server directory. It is free with no signup and runs fully in your browser, so nothing is uploaded. The honest caveats: .htaccess is Apache only and does nothing on Nginx or LiteSpeed-without-support; some shared hosts disable certain directives, so test the file on staging first; and the tool cannot see your existing .htaccess, so merge its output with rules you already have instead of overwriting them.

Frequently asked questions

Popular searches

htaccess generatorhtaccess buildergenerate htaccessapache htaccess generatorhtaccess redirect generatorhttps redirect htaccesswww redirect htaccessforce https htaccesshtaccess www to non wwwgzip htaccessenable gzip htaccessbrowser caching htaccessexpires headers htaccesssecurity headers htaccesshsts htaccessx-frame-options htaccesscontent security policy htaccesscustom error pages htaccess404 page htaccessdisable directory listing htaccesshotlink protection htaccessprevent image hotlinkingrewrite rules generatorhtaccess rewrite generatorredirect 301 htaccesshtaccess redirect exampleshtaccess cheat sheetapache config generatorhtaccess file creatorcreate htaccess onlinehtaccess for wordpresshtaccess seohtaccess performancehtaccess securityfree htaccess toolhtaccess generator no signuphtaccess snippetscommon htaccess ruleshtaccess redirect http to httpshtaccess force wwwhtaccess remove wwwhtaccess trailing slashhtaccess file downloadhtaccess expiresbytypehtaccess deflatehtaccess cache controlhtaccess visual builderhtaccess online editorbuild htaccess filehtaccess testerhtaccess for apachehtaccess redirect wwwhtaccess compression

More tools

Coming soon

CLI

Coming soon

Figma plugin

Coming soon

VS Code extension

Coming soon

Chrome extension

Coming soon

AI icon generator

Coming soon

Team workspaces

Coming soon

View all 10+ tools →