# Digital Card — Apache rules (works in the domain root or any sub-folder; no RewriteBase needed)
<IfModule mod_dir.c>
  DirectoryIndex index.php index.html
</IfModule>

<IfModule mod_rewrite.c>
  RewriteEngine On

  # Never serve internals, even if a host forgot per-folder protection
  RewriteRule ^(includes|config|storage)(/|$) - [F,L]
  RewriteRule ^install/(schema\.sql|lib\.php)$ - [F,L]
  RewriteRule (^|/)\.(?!well-known) - [F,L]

  # Pretty card URLs:  /username  ->  profile.php?u=username
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^([A-Za-z0-9_-]{3,70})/?$ profile.php?u=$1 [L,QSA]
</IfModule>

<FilesMatch "\.(sql|log|lock|bak|ini|md)$">
  <IfModule mod_authz_core.c>Require all denied</IfModule>
  <IfModule !mod_authz_core.c>Order allow,deny
  Deny from all</IfModule>
</FilesMatch>

<IfModule mod_headers.c>
  Header always set X-Content-Type-Options "nosniff"
  <FilesMatch "\.(css|js|png|jpg|jpeg|gif|webp|svg|woff2)$">
    Header set Cache-Control "public, max-age=2592000"
  </FilesMatch>
</IfModule>
<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE text/html text/css application/javascript image/svg+xml application/json
</IfModule>
