<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /parcel-tracker-php/
    DirectoryIndex index.php pages/index.php pages/login.php
    
    # Allow direct access to files and folders
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    
    # Redirect to login page if file doesn't exist
    RewriteRule ^(.*)$ pages/login.php [L]
</IfModule>

# Deny access to sensitive files
<FilesMatch "\.env|config\.php">
    Order allow,deny
    Deny from all
</FilesMatch>

# Enable gzip compression
<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript
</IfModule>
