# GHDI — Apache (cPanel shared hosting) rules

# Block internals
RewriteRule ^(app|storage)(/|$) - [F,L]
RewriteRule ^config\.local\.php$ - [F,L]

# Front controller for pretty routes (/admin, /staff, /student, /fees, /api/...)
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^ index.php [L]
</IfModule>

# Never execute PHP from uploads (defense in depth)
<Directory "uploads">
  php_flag engine off
  Options -Indexes
</Directory>

# Bigger uploads (works on most cPanel hosts; may be overridden by server policy)
<IfModule mod_php.c>
  php_value upload_max_filesize 12M
  php_value post_max_size 14M
</IfModule>

# Gzip + caching for static assets
<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE text/html text/css application/javascript image/svg+xml
</IfModule>
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType image/webp "access plus 7 days"
  ExpiresByType image/png "access plus 7 days"
  ExpiresByType image/jpeg "access plus 7 days"
  ExpiresByType text/css "access plus 1 day"
  ExpiresByType application/javascript "access plus 1 day"
</IfModule>
