# Chandramauli Trust MIS — web root settings for Apache / LiteSpeed (cPanel).

# The front door is index.php; never list a folder's contents.
DirectoryIndex index.php
Options -Indexes

# ----------------------------------------------------------------------
# HTTPS only. Sign-in sends a password and every page carries children's
# and donors' records, so nothing travels unencrypted.
#
# If the site will not open because the certificate is not ready yet
# (cPanel → SSL/TLS Status shows AutoSSL still pending), put a # in front
# of the RewriteRule line below, and take it out again once
# https://your-address works.
# ----------------------------------------------------------------------
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{HTTPS} !=on
  RewriteCond %{HTTP:X-Forwarded-Proto} !https
  RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>

# Hidden files (.user.ini, .git, editor leftovers) are never served.
<FilesMatch "^\.">
  Require all denied
</FilesMatch>

# Backups and notes that might be left lying in the web root by hand.
<FilesMatch "\.(?i:bak|old|orig|swp|sql|md|log|ini|env|zip|tar|gz)$">
  Require all denied
</FilesMatch>

<IfModule mod_headers.c>
  # Do not let the browser guess file types, or frame these pages elsewhere.
  Header always set X-Content-Type-Options "nosniff"
  Header always set X-Frame-Options "SAMEORIGIN"
  Header always set Referrer-Policy "strict-origin-when-cross-origin"
  Header always set Permissions-Policy "camera=(), microphone=(), geolocation=()"
  # Once HTTPS is confirmed working, browsers are told to use nothing else.
  Header always set Strict-Transport-Security "max-age=31536000" env=HTTPS
</IfModule>

# Stylesheets and scripts carry ?v=<version>, so they can be cached hard.
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType text/css "access plus 30 days"
  ExpiresByType application/javascript "access plus 30 days"
  ExpiresByType image/png "access plus 30 days"
  ExpiresByType image/svg+xml "access plus 30 days"
</IfModule>
