RewriteEngine On

RewriteCond %{REQUEST_URI} !^/MYMEHNAAZ/MEHNAAZ_CLOSING/1mehnaaz_binary_closing\.php$
RewriteCond %{REQUEST_URI} !^/MYMEHNAAZ/MEHNAAZ_CLOSING/2mehnaaz_repurchase_binary_closing\.php$
RewriteCond %{REQUEST_URI} !^/MYMEHNAAZ/MEHNAAZ_CLOSING/3mehnaaz_closing_credit\.php$
RewriteCond %{REQUEST_URI} !^/MYMEHNAAZ/show_image\.php$

RewriteCond %{THE_REQUEST} /MYMEHNAAZ/ [NC]

RewriteRule ^ - [F]
php_flag display_errors Off 
php_flag log_errors On 
#php_value error_log /home/mehnxngf/public_html/MYMEHNAAZ/mehnaaz_error_log



# Disable directory listing
Options -Indexes

# Default index
DirectoryIndex index.php index.html

# Protect sensitive files
<FilesMatch "\.(htaccess|htpasswd|ini|log|conf|env)$">
    Require all denied
</FilesMatch>

ErrorDocument 403 /403.html


# ===============================
# 🔥 COMPRESSION
# ===============================

<IfModule mod_brotli.c>
  AddOutputFilterByType BROTLI_COMPRESS text/html text/plain text/css application/javascript application/json image/svg+xml
</IfModule>

<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE text/html text/plain text/css application/javascript application/json image/svg+xml
  Header append Vary Accept-Encoding
</IfModule>


# ===============================
# 🚀 CACHING (CLEAN VERSION)
# ===============================

<IfModule mod_expires.c>
  ExpiresActive On

  # Images & Fonts → 1 Year
  ExpiresByType image/jpeg "access plus 1 year"
  ExpiresByType image/png "access plus 1 year"
  ExpiresByType image/webp "access plus 1 year"
  ExpiresByType image/svg+xml "access plus 1 year"
  ExpiresByType font/woff2 "access plus 1 year"

  # CSS & JS → 1 Year (use versioning!)
  ExpiresByType text/css "access plus 1 year"
  ExpiresByType application/javascript "access plus 1 year"

  # HTML → No cache (important)
  ExpiresByType text/html "access plus 0 seconds"
</IfModule>


<IfModule mod_headers.c>

  # Remove ETag
  Header unset ETag

  # Long cache for static files
  <FilesMatch "\.(css|js|jpg|jpeg|png|gif|svg|webp|woff2)$">
    Header set Cache-Control "public, max-age=31536000, immutable"
  </FilesMatch>

  # Security headers
  Header set X-Content-Type-Options "nosniff"
  Header always set X-Frame-Options "SAMEORIGIN"

</IfModule>

FileETag None