# Rechtsanwalt Peter Müller — Routing

RewriteEngine On

# robots.txt und Sitemaps auf PHP-Generatoren umleiten
RewriteRule ^robots\.txt$ robots.php [L]
RewriteRule ^sitemap\.xml$ sitemap.php?type=index [L,QSA]
RewriteRule ^sitemap-pages\.xml$ sitemap.php?type=pages [L,QSA]
RewriteRule ^sitemap-images\.xml$ sitemap.php?type=images [L,QSA]

# Alle anderen Aufrufe (die keine echte Datei/Ordner sind) über index.php ausliefern
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?slug=$1 [QSA,L]

# Verzeichnis-Auflistung deaktivieren
Options -Indexes

<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE text/html text/css application/javascript image/svg+xml application/json application/xml
</IfModule>

# CSS/JS werden mit ?v=<Änderungszeit> eingebunden und dürfen lange gecacht werden
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType text/css "access plus 1 year"
  ExpiresByType application/javascript "access plus 1 year"
  ExpiresByType image/jpeg "access plus 30 days"
  ExpiresByType image/png "access plus 30 days"
  ExpiresByType image/webp "access plus 30 days"
  ExpiresByType image/svg+xml "access plus 30 days"
</IfModule>
