Files
Dialyse-Webseite/.htaccess
T

57 lines
2.0 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]
# Redirect /de/... to canonical root /... (German is the default language)
RewriteRule ^de/?$ / [R=301,L]
RewriteRule ^de/main\.html$ / [R=301,L]
RewriteRule ^de/([0-9a-zA-Z\-]+)\.html$ /$1.html [R=301,L]
# English subpath routing (/en/ and /en/<page>.html)
RewriteRule ^en/main\.html$ /en/ [R=301,L]
RewriteRule ^en/?$ index.php?lang=en&action=main [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^en/([0-9a-zA-Z\-]+)\.html$ index.php?lang=en&action=$1 [QSA,L]
# Clean URL routing for .html pages (German default)
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>