Files
Dialyse-Webseite/.htaccess
T
2026-10-20 12:02:30 +02:00

46 lines
1.6 KiB
ApacheConf

Options +FollowSymLinks
RewriteEngine on
# Redirect duplicate homepage URLs (/main.html and /index.php) to canonical root /
RewriteRule ^main\.html$ / [R=301,L]
RewriteCond %{THE_REQUEST} \s/+index\.php[\s?] [NC]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^index\.php$ / [R=301,L]
# Clean URL routing for .html pages
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{QUERY_STRING} ([a-zA-Z0-9-_.=&+%]*)
RewriteRule ^([0-9a-zA-Z\-]+).html$ index.php?action=$1&%1 [L]
# Custom 404 handler
ErrorDocument 404 /index.php?action=404
# Advertise HTTP/3 (h3) support via Alt-Svc header
<IfModule mod_headers.c>
Header setIfEmpty Alt-Svc "h3=\":443\"; ma=86400"
</IfModule>
# Gzip / Deflate Compression for Core Web Vitals & PageSpeed
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript application/ld+json image/svg+xml
</IfModule>
# Browser Caching for Static Assets
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/x-icon "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 application/pdf "access plus 7 days"
ExpiresByType font/ttf "access plus 1 year"
</IfModule>
<Files .htaccess>
Require all denied
</Files>