# =============================================================================
#  节点云运维面板 · Apache 重写规则
#  生产环境建议使用 Nginx，见 docs/DEPLOY.md
# =============================================================================

<IfModule mod_rewrite.c>
  Options +FollowSymlinks -Multiviews
  RewriteEngine On

  # 安装向导存在时优先访问
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1]
</IfModule>

<IfModule mod_headers.c>
  Header set X-Content-Type-Options "nosniff"
  Header set X-Frame-Options "SAMEORIGIN"
  Header set X-XSS-Protection "1; mode=block"
  Header always unset X-Powered-By
</IfModule>

# 禁止访问敏感文件
<FilesMatch "\.(env|lock|sql|log|json|md)$">
  Require all denied
</FilesMatch>

# 禁止执行 data 目录下的脚本
RedirectMatch 403 ^/.*/(data|runtime)/.*\.(php|php5|phtml)$
