# ----------------------------- # 1) Prevent directory listings # ----------------------------- Options -Indexes # ----------------------------- # 2) Default index files # ----------------------------- DirectoryIndex index.html # ----------------------------- # 3) Deny access to hidden files # ----------------------------- # (blocks access to .htaccess, .gitignore, etc.) Require all denied # ----------------------------- # 4) Enforce HTTPS (optional) # ----------------------------- # Uncomment if you have SSL configured #RewriteEngine On #RewriteCond %{HTTPS} off #RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] # Prevent clickjacking Header always set X-Frame-Options "SAMEORIGIN" # Block XSS Header always set X-XSS-Protection "1; mode=block" # No MIME sniffing Header always set X-Content-Type-Options "nosniff" # HTML: always revalidate Header set Cache-Control "no-cache, no-store, must-revalidate" Header set Pragma "no-cache" Header set Expires "0" # JS/CSS: short‑term cache, revalidate regularly Header set Cache-Control "public, max-age=3600, must-revalidate"