# Disable directory browsing
Options -Indexes

# Protect hidden files from being viewed
<Files .*>
    Order Deny,Allow
    Deny From All
</Files>

# Protect application and system files from being viewed
<FilesMatch "^(composer\.json|composer\.lock|\.env|\.gitignore)">
    Order Allow,Deny
    Deny from all
</FilesMatch>

# Enable rewriting
RewriteEngine On

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

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

# PHP error handling
php_flag display_errors off
php_value error_reporting E_ALL
php_value error_log logs/error.log
