# All Property Matters: Apache rules (shared hosting / cPanel friendly)
Options -Indexes
DirectoryIndex index.php

<IfModule mod_rewrite.c>
RewriteEngine On

# Force HTTPS (uncomment once the SSL certificate is active)
# RewriteCond %{HTTPS} !=on
# RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# Serve real files and folders directly, send everything else to the front controller
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [L]
</IfModule>

# Never serve hidden or sensitive file types
<FilesMatch "(^\.|\.(sql|log|ini|bak|md|example)$)">
  Require all denied
</FilesMatch>

# Uploaded listing photos: no script execution
<IfModule mod_php.c>
  <Directory "uploads">
    php_flag engine off
  </Directory>
</IfModule>

# Caching for static assets (the ?v= query string busts the cache on change)
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType image/png  "access plus 1 year"
  ExpiresByType image/jpeg "access plus 1 year"
  ExpiresByType image/webp "access plus 1 year"
  ExpiresByType text/css   "access plus 1 year"
  ExpiresByType application/javascript "access plus 1 year"
</IfModule>

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

# Security headers (HSTS only after HTTPS is confirmed working)
<IfModule mod_headers.c>
  # Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains"
</IfModule>
