WordPress
Prefer .htaccess auto_prepend_file when the server supports it; if php_value is unavailable, include AWAF at the beginning of wp-config.php and verify the protected entry points.
Preferred method
On Apache with mod_php and allowed php_value, place the directive in the WordPress root .htaccess and use the absolute AWAF path.
php_value auto_prepend_file "<path_to_directory>/antibot/index.php"Protected entry points
AWAF loads before each PHP file in scope, including index.php, wp-login.php, admin-ajax.php, wp-cron.php, plugin callbacks, and direct legacy scripts. This is broader than adding code only to a theme or front controller.
If php_value is unavailable
If php_value is unavailable, add the following at the beginning of wp-config.php, immediately after the opening <?php tag and before the rest of the code:
require_once $_SERVER["DOCUMENT_ROOT"]."/antibot/index.php";This example assumes that the antibot directory is located in the website document root (DOCUMENT_ROOT). If it is installed elsewhere, specify the absolute path to antibot/index.php. For WP-CLI or CLI cron jobs, use the correct absolute path instead of DOCUMENT_ROOT.
Including AWAF through wp-config.php covers requests that load WordPress, but not standalone PHP handlers that bypass its bootstrap.
Checklist
- Test home, posts, categories, search, and 404 pages.
- Test wp-login.php, wp-admin/, admin-ajax.php, /wp-json/, and wp-cron.php if used through web.
- Check forms, payments, plugin callbacks, and sitemap/XML.
- Add narrow whitelist_url rules for endpoints where captcha is not acceptable.