Quick Presets
Basic Settings
Space-separated list of default files
Security Headers
URL Redirects
No redirects configured. Click "Add Redirect" to create one.
Browser Caching
.css
Cache for 1 year
.js
Cache for 1 year
.png|jpg|jpeg|gif|ico|svg
Cache for 1 year
.woff|woff2|ttf|eot
Cache for 1 year
.pdf
Cache for 1 month
.html|htm
Cache for 1 day
Custom Rules
Advanced users can add custom Apache directives
Generated .htaccess
apache
# Generated by devtools.software
# .htaccess file
# Directory index files
DirectoryIndex index.html index.php
# Force HTTPS
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Security headers
<IfModule mod_headers.c>
Header always set X-XSS-Protection "1; mode=block"
Header always set X-Content-Type-Options "nosniff"
Header always set X-Frame-Options "SAMEORIGIN"
</IfModule>
# Gzip compression
<IfModule mod_deflate.c>
# Compress HTML, CSS, JavaScript, Text, XML and fonts
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/x-font-otf
AddOutputFilterByType DEFLATE application/x-font-truetype
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE font/opentype
AddOutputFilterByType DEFLATE font/otf
AddOutputFilterByType DEFLATE font/ttf
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE image/x-icon
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/xml
</IfModule>
# Browser caching
<IfModule mod_expires.c>
ExpiresActive on
ExpiresByType image/css "access plus 1 year"
ExpiresByType text/css "access plus 1 year"
ExpiresByType image/js "access plus 1 year"
ExpiresByType application/javascript "access plus 1 year"
ExpiresByType text/javascript "access plus 1 year"
ExpiresByType image/png|image/jpg|jpeg|gif|ico|svg "access plus 1 year"
ExpiresByType image/woff|image/woff2|ttf|eot "access plus 1 year"
ExpiresByType font/woff "access plus 1 year"
ExpiresByType font/woff2 "access plus 1 year"
ExpiresByType application/font-woff "access plus 1 year"
ExpiresByType image/pdf "access plus 1 month"
ExpiresByType application/pdf "access plus 1 month"
</IfModule>Usage Instructions
Installation
- • Download the generated .htaccess file
- • Upload it to your website's root directory
- • Ensure your server supports Apache mod_rewrite
- • Test redirects and functionality
- • Monitor server error logs for issues
Security Features
- • HTTPS redirects for secure connections
- • Security headers prevent common attacks
- • HSTS enforces HTTPS for repeat visitors
- • Content-Type sniffing protection
- • Clickjacking protection with X-Frame-Options
Performance
- • Gzip compression reduces file sizes
- • Browser caching improves load times
- • Proper cache headers for different file types
- • Leverage browser caching for static assets
- • Reduce server load with client-side caching
Common Issues
- • Check server supports required modules
- • Verify correct file permissions (644)
- • Test redirects don't create loops
- • Monitor server error logs
- • Backup existing .htaccess before replacing