DirectoryIndex index.html index.php

RewriteEngine On

# Route everything except real files/directories through index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [QSA,L]

# Compress text-based responses (perf requirement)
<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/html text/css application/javascript application/json text/plain
</IfModule>

# Basic caching for static assets
<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType text/css "access plus 1 week"
    ExpiresByType application/javascript "access plus 1 week"
    ExpiresByType image/png "access plus 1 month"
    ExpiresByType image/jpg "access plus 1 month"
</IfModule>

# Never expose these directly
<FilesMatch "\.(sql|log|md)$">
    Require all denied
</FilesMatch>
