.htaccess Generator
Generate an Apache .htaccess file online — HTTPS redirect, www/non-www canonical, 301 redirects, SPA fallback, gzip and caching rules.
301 redirects
| From path | To URL / path |
|---|
.htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
# Force HTTPS
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/css application/javascript application/json image/svg+xml
</IfModule>
# Deny access to dotfiles
<FilesMatch "^\.">
Require all denied
</FilesMatch>About .htaccess Generator
Compose a production-ready .htaccess without looking up mod_rewrite syntax: force HTTPS, pick a canonical www or non-www host, add 301 redirect pairs, enable gzip, cache static assets and protect dotfiles.
For single-page apps there is a one-click SPA fallback that serves index.html for unknown paths. The file updates live and downloads as .htaccess.