# InvenTrack — Security & Routing

# Default page is login
DirectoryIndex login.html index.html

# Custom error pages
ErrorDocument 404 /404.html
ErrorDocument 500 /500.html
ErrorDocument 403 /404.html

# Protect config file
<Files "config.php">
    Order Allow,Deny
    Deny from all
</Files>

# Block direct access to .sql files
<FilesMatch "\.(sql|md)$">
    Order Allow,Deny
    Deny from all
</FilesMatch>

# Compress text responses — index.html is a large single-file app (no
# bundler/code-splitting), so this is the single biggest safe win for load
# time: typically a 70-80% size reduction over the wire for HTML/JS/CSS/JSON,
# with zero functional risk since browsers decompress it automatically.
<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/html text/css text/plain text/xml
    AddOutputFilterByType DEFLATE application/javascript application/json
    AddOutputFilterByType DEFLATE image/svg+xml
</IfModule>

# Cache static assets
<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType text/html "access plus 0 seconds"
    ExpiresByType text/css "access plus 1 month"
    ExpiresByType application/javascript "access plus 1 month"
    ExpiresByType image/svg+xml "access plus 1 month"
</IfModule>

# Security headers
<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>
