# sistema_cobranca_pro/.htaccess

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    # Redirecionar todas as requisições para index.php, exceto arquivos e diretórios existentes
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php [L]

    # Bloquear acesso direto a arquivos de configuração e includes
    RewriteRule ^(config|includes|install|api|cronjobs)/.*$ - [F,L]

    # Bloquear acesso a arquivos .sql
    <FilesMatch "\.sql$">
        Order allow,deny
        Deny from all
    </FilesMatch>

    # Bloquear acesso a arquivos .env (se existirem)
    <FilesMatch "\.env$">
        Order allow,deny
        Deny from all
    </FilesMatch>

    # Forçar HTTPS (opcional, descomente se tiver SSL)
    # RewriteCond %{HTTPS} off
    # RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

</IfModule>

# Definir o charset padrão
AddDefaultCharset UTF-8

# Configurações de PHP (opcional, pode ser feito no php.ini)
<IfModule mod_php7.c>
    php_value display_errors Off
    php_value display_startup_errors Off
    php_value error_reporting E_ALL
    php_value log_errors On
    php_value error_log /var/log/apache2/php_errors.log
    php_value upload_max_filesize 100M
    php_value post_max_size 100M
    php_value max_execution_time 300
    php_value max_input_time 300
    php_value memory_limit 256M
</IfModule>

<IfModule mod_php.c>
    php_value display_errors Off
    php_value display_startup_errors Off
    php_value error_reporting E_ALL
    php_value log_errors On
    php_value error_log /var/log/apache2/php_errors.log
    php_value upload_max_filesize 100M
    php_value post_max_size 100M
    php_value max_execution_time 300
    php_value max_input_time 300
    php_value memory_limit 256M
</IfModule>



