# Все запросы — на фронт-контроллер
RewriteEngine On

# Существующие файлы и каталоги отдаём как есть
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

RewriteRule ^ index.php [L]

# Кэш статики
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType text/css "access plus 30 days"
  ExpiresByType application/javascript "access plus 30 days"
  ExpiresByType image/jpeg "access plus 180 days"
  ExpiresByType image/png "access plus 180 days"
  ExpiresByType image/svg+xml "access plus 180 days"
  ExpiresByType image/webp "access plus 180 days"
</IfModule>

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

<IfModule mod_headers.c>
  Header set X-Content-Type-Options "nosniff"
  Header set X-Frame-Options "SAMEORIGIN"
  Header set Referrer-Policy "strict-origin-when-cross-origin"
</IfModule>

# Загруженные файлы не исполняем
<FilesMatch "\.(php|phtml|php3|php5|phar)$">
  <IfModule mod_authz_core.c>
    Require all granted
  </IfModule>
</FilesMatch>
