best
.htaccess Generator — best
Generate Apache .htaccess rules for redirects and security.
# Generated by ToolHQ .htaccess Generator
Options -Indexes
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# Force HTTPS
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>
# Enable Gzip compression
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/css application/javascript
</IfModule>
# Browser caching
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/javascript "access plus 1 month"
</IfModule>How to use .htaccess Generator
1
Choose Your Redirect Type
Select from permanent (301), temporary (302), or external redirects to begin generating your .htaccess rules
2
Enter Your Redirect URL
Enter the URL you want to redirect from and the URL you want to redirect to
3
Add Security Rules
Select from a range of security options, including password protection, IP blocking, and file type restrictions
4
Generate and Download
Click the 'Generate' button to create your custom .htaccess rules, and download them as a text file