Options -Indexes -MultiViews
ServerSignature Off

<IfModule mod_rewrite.c>
    RewriteEngine On

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

    RewriteRule ^(?:config|sql|includes|cron)/ - [F,L,NC]
    RewriteRule ^(?:setup\.php|server-status)$ - [F,L,NC]
    RewriteRule ^assets/img/projects/.*\.(?:php|phtml|phar|php\d*)$ - [F,L,NC]
</IfModule>

<FilesMatch "(^\.|composer\.(json|lock)$|package\.json$|webpack\..+$|phpinfo\.php$|info\.php$|.*\.(?:env|ini|log|sql|bak|old|tmp|swp|md|zip|tar|gz|7z|yml|yaml|dist|example))">
    Require all denied
</FilesMatch>

<LimitExcept GET POST HEAD>
    Require all denied
</LimitExcept>

<IfModule mod_headers.c>
    Header always set X-Frame-Options "DENY"
    Header always set X-Content-Type-Options "nosniff"
    Header always set Referrer-Policy "strict-origin-when-cross-origin"
    Header always set Permissions-Policy "accelerometer=(), autoplay=(), camera=(), display-capture=(), geolocation=(), gyroscope=(), microphone=(), payment=(), usb=()"
    Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains"
    Header always unset X-Powered-By
</IfModule>

<IfModule mod_php.c>
    php_flag display_errors Off
    php_flag display_startup_errors Off
    php_flag log_errors On
    php_value error_reporting 32767
    php_flag session.cookie_httponly On
    php_flag session.cookie_secure On
    php_value session.cookie_samesite "Strict"
    php_flag session.use_strict_mode On
    php_flag session.use_only_cookies On
</IfModule>

<IfModule mod_php8.c>
    php_flag display_errors Off
    php_flag display_startup_errors Off
    php_flag log_errors On
    php_value error_reporting 32767
    php_flag session.cookie_httponly On
    php_flag session.cookie_secure On
    php_value session.cookie_samesite "Strict"
    php_flag session.use_strict_mode On
    php_flag session.use_only_cookies On
</IfModule>
