# Force PHP 8.1
<IfModule mime_module>
    AddHandler application/x-httpd-ea-php81 .php
</IfModule>

# Alternative for some hosts
# AddHandler application/x-httpd-php81 .php

# Security
<Files ".env">
    Order allow,deny
    Deny from all
</Files>

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

# v27.52: block backups and other sensitive file types.
<FilesMatch "\.(bak|backup|old|orig|save|swp|swo|sql|ini|sh|md|yml|yaml|lock|dist|example)$">
    Order allow,deny
    Deny from all
</FilesMatch>

# Disable directory listing
Options -Indexes

# Enable rewrite
<IfModule mod_rewrite.c>
    RewriteEngine On
    
    # Force HTTPS
    # RewriteCond %{HTTPS} off
    # RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>

<Files "error_log">
    Order allow,deny
    Deny from all
</Files>

<FilesMatch "(^error_log$|\.(log|sql|env|ini|bak|backup|old|orig|save|swp|swo|md|yml|yaml|lock|dist|example)$)">
    Order allow,deny
    Deny from all
</FilesMatch>
