DLE CMS
Apache/PHP 支持时,DLE CMS 优先使用 .htaccess auto_prepend_file。这样可以在 CMS 代码之前启动防护,并覆盖直接访问的 PHP endpoint。
推荐方式
Apache mod_php 且允许 php_value 时,在 DLE 站点根目录 .htaccess 中添加该指令,并使用 AWAF 的绝对路径。
php_value auto_prepend_file "<目录路径>/antibot/index.php"DLE CMS 回退
如果 php_value 不可用,请使用 .user.ini、vhost/pool 配置或主机面板设置。如果这些方式都不可用,请把 AWAF 加到 DLE 的早期公共入口,通常是 index.php,并放在 CMS core 和 HTML 输出之前。
require_once $_SERVER['DOCUMENT_ROOT'].'/antibot/index.php';验证
- 修改前备份 .htaccess、.user.ini 或 index.php。
- 测试首页、新闻页、分类、搜索、评论、登录和管理后台。
- 测试 AJAX、cron、sitemap/XML、RSS 和其他 DLE 服务 endpoint。
- 确认 logs/、cache/、lists/ 对 Web 服务器可写。
- 对不适合验证码的服务 URL 添加精确 whitelist_url/captcha_uri 规则。
为什么不只用 index.php
只在 index.php include 可能漏掉独立 PHP 脚本、AJAX handler 和服务路由。auto_prepend_file 会在范围内每个 PHP 文件之前启动 AWAF,因此对 DLE CMS 覆盖更完整。