# BRAVEN — Apache configuration (shared hosting)
Options -Indexes
DirectoryIndex index.php

<IfModule mod_rewrite.c>
  RewriteEngine On
  # If the site is in a subfolder, change to: RewriteBase /subfolder/
  RewriteBase /

  # Force HTTPS (uncomment after SSL is active)
  # RewriteCond %{HTTPS} off
  # RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

  # Remove www (optional)
  # RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
  # RewriteRule ^ https://%1%{REQUEST_URI} [L,R=301]

  # Block sensitive files
  RewriteRule ^(config\.php|database\.sql|install\.lock)$ - [F,L]
  RewriteRule ^(includes|templates|pages|backups)(/|$) - [F,L]

  # Front controller
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?route=$1 [QSA,L]
</IfModule>

<FilesMatch "\.(sql|lock|log|ini|md)$">
  Require all denied
</FilesMatch>

<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType image/svg+xml "access plus 1 month"
  ExpiresByType image/png "access plus 1 month"
  ExpiresByType image/jpeg "access plus 1 month"
  ExpiresByType image/webp "access plus 1 month"
  ExpiresByType text/css "access plus 1 month"
  ExpiresByType application/javascript "access plus 1 month"
</IfModule>

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