# Enable PHP error logging
# PRODUCTION: Disable display_errors, only log errors
# For local development with folder name "prehospital":
php_flag display_errors Off
php_flag log_errors On
php_value error_log "C:/xampp/htdocs/prehospital/php_error.log"
php_value error_reporting 32767

# NOTE: When deploying to production, change the error_log path to:
# php_value error_log "/home/rescue116link/public_html/php_error.log"

# Enable rewrite engine
RewriteEngine On

# Redirect all requests to index.php if the requested file or directory does not exist
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]

# Security headers
<IfModule mod_headers.c>
    Header always set X-Frame-Options DENY
    Header always set X-Content-Type-Options nosniff
    Header always set X-XSS-Protection "1; mode=block"
    Header always set Referrer-Policy "strict-origin-when-cross-origin"
</IfModule>

# Prevent access to sensitive files
<Files "config.php">
    Order allow,deny
    Deny from all
</Files>

<Files "*.log">
    Order allow,deny
    Deny from all
</Files>

# Enable compression
<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/plain
    AddOutputFilterByType DEFLATE text/html
    AddOutputFilterByType DEFLATE text/xml
    AddOutputFilterByType DEFLATE text/css
    AddOutputFilterByType DEFLATE application/xml
    AddOutputFilterByType DEFLATE application/xhtml+xml
    AddOutputFilterByType DEFLATE application/rss+xml
    AddOutputFilterByType DEFLATE application/javascript
    AddOutputFilterByType DEFLATE application/x-javascript
</IfModule>

# Set default charset
AddDefaultCharset UTF-8

# Hide directory listing
Options -Indexes
