RewriteEngine On

# Compatibilidade com launchers antigas: elas pedem diretamente
# /api/connection_log.json. O JSON bruto continua protegido pela aplicacao;
# a URL publica e atendida pelo endpoint que filtra e limita os campos.
RewriteRule ^connection_log\.json$ connection_notice.php [NC,L,QSA]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php [NC,L]

AddType application/x-httpd-php .html .htm

<FilesMatch "(?i)(^\.|\.(?:db|sqlite|sqlite3)(?:-(?:wal|shm))?$|\.sql$|\.log$|\.ini$)">
    <IfModule mod_authz_core.c>
        Require all denied
    </IfModule>
    <IfModule !mod_authz_core.c>
        Order Allow,Deny
        Deny from all
    </IfModule>
</FilesMatch>

<FilesMatch "(?i)^(command\.txt|reports\.json)$">
    <IfModule mod_authz_core.c>
        Require all denied
    </IfModule>
    <IfModule !mod_authz_core.c>
        Order Allow,Deny
        Deny from all
    </IfModule>
</FilesMatch>
