# RastreaBR — Configuração Apache para cPanel
# Coloque este arquivo na raiz do projeto

Options -Indexes
Options -MultiViews

# ===== SEGURANÇA =====
# Bloquear acesso direto à pasta /data
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^data/ - [F,L]
</IfModule>

# Bloquear acesso a arquivos sensíveis
<FilesMatch "\.(json|log|bak|sql|env)$">
    Order Allow,Deny
    Deny from all
</FilesMatch>

# Permitir apenas o PHP acessar os JSONs (exceção para assets)
<Files "api.php">
    Order Allow,Deny
    Allow from all
</Files>

# ===== HEADERS DE SEGURANÇA =====
<IfModule mod_headers.c>
    Header always set X-Frame-Options SAMEORIGIN
    Header always set X-Content-Type-Options nosniff
    Header always set Referrer-Policy strict-origin-when-cross-origin
</IfModule>

# ===== CACHE =====
<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType text/html "access plus 1 hour"
    ExpiresByType text/css "access plus 1 week"
    ExpiresByType application/javascript "access plus 1 week"
    ExpiresByType image/jpeg "access plus 1 month"
    ExpiresByType image/png "access plus 1 month"
</IfModule>

# ===== COMPRESSÃO =====
<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/html text/css application/javascript application/json
</IfModule>

# ===== URL LIMPAS (opcional) =====
# <IfModule mod_rewrite.c>
#     RewriteEngine On
#     RewriteBase /
#     RewriteCond %{REQUEST_FILENAME} !-f
#     RewriteCond %{REQUEST_FILENAME} !-d
#     RewriteRule ^ index.html [L]
# </IfModule>
