# JournalSphere CMS - root .htaccess
Options -Indexes
DirectoryIndex index.php

# Force HTTPS (SSL) except on localhost
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTP_HOST} !^(localhost|127\.0\.0\.1)
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>

# Block direct access to sensitive files
<FilesMatch "\.(sql|md|log|lock|sample|gz|bak|ini)$">
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
</FilesMatch>

<IfModule mod_headers.c>
Header always set X-Content-Type-Options "nosniff"
Header always set X-Frame-Options "SAMEORIGIN"
</IfModule>
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/css application/javascript application/json
</IfModule>
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/javascript "access plus 1 month"
ExpiresByType image/svg+xml "access plus 1 month"
</IfModule>
