<IfModule mod_rewrite.c>
RewriteEngine On

# FORCE HTTPS
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# REACT ROUTER
RewriteBase /

RewriteRule ^index\.html$ - [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]

</IfModule>

# BLOCK DIRECTORY LISTING
Options -Indexes

# SECURITY HEADER
<IfModule mod_headers.c>
Header set X-Content-Type-Options "nosniff"
Header set X-Frame-Options "SAMEORIGIN"
Header set X-XSS-Protection "1; mode=block"
</IfModule>

# BLOCK SENSITIVE FILES
<FilesMatch "(\.env|composer\.json|package\.json|vite\.config\.js)">
Order Allow,Deny
Deny from all
</FilesMatch>