.htaccess-Generator
.htaccess-Regeln für Weiterleitungen, Passwortschutz und Caching generieren
Configuration Options
Force HTTPS
Redirect all HTTP traffic to HTTPS using mod_rewrite
Force www
Redirect non-www requests to www subdomain
Redirect URL
Enable GZIP Compression
Compress HTML, CSS, JS, and other text responses with mod_deflate
Browser Caching
Set cache expiry for images (1 month) and CSS/JS (1 week)
Block File Types
Comma-separated extensions to deny access to (e.g. log, bak, sql)
Custom 404 Page
Protect .htaccess
Deny direct HTTP access to the .htaccess file itself
.htaccess Output
# Force HTTPS
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>
# Enable GZIP Compression
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/json
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE 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/gif "access plus 1 month"
ExpiresByType image/png "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 week"
ExpiresByType application/javascript "access plus 1 week"
ExpiresByType text/javascript "access plus 1 week"
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType text/html "access plus 1 hour"
</IfModule>
# Custom 404 Page
ErrorDocument 404 /404.html
# Protect .htaccess
<Files .htaccess>
Order Allow,Deny
Deny from all
</Files>Weiter entdecken
Weitere Entwickler-Tools, die Ihnen gefallen könnten…
JSON-Formatierer
JSON mit Syntaxhervorhebung und Fehlererkennung formatieren, validieren und minifizieren
Base64 Encoder/Decoder
Text oder Dateien nach Base64 kodieren und Base64-Strings in lesbaren Text dekodieren
URL Encoder/Decoder
URL-Komponenten und Query-String-Parameter kodieren und dekodieren
UUID-Generator
Zufällige UUIDs (v1, v4) generieren oder mehrere UUIDs in Bulk erstellen
Hash-Generator
MD5-, SHA-1-, SHA-256-, SHA-512-Hashes aus Text oder Dateien generieren
Regex-Tester
Reguläre Ausdrücke mit Echtzeit-Übereinstimmungshervorhebung testen
JWT-Decoder
JSON Web Tokens dekodieren und prüfen — Header, Payload und Signaturen ansehen
HTML-Formatierer
HTML-Code mit korrekter Einrückung und Syntaxhervorhebung formatieren