A WordPress plugin by Carles Mateo. Block abusive IPs and URL scanners
(.env,
wp-config.php,
.git and custom patterns).
Manual IP/range deny rules, automatic offender collection, CSV & ufw export.
Description
PHP Firewall protects your site by blocking abusive visitors as early as possible in the request, before WordPress finishes loading.
When protection is enabled, every request is checked:
Built-in scanner signatures: .env, wp-config.php, .git.
You can add your own substring patterns too.
Choose which header carries the real visitor IP: REMOTE_ADDR,
Cloudflare (CF-Connecting-IP), X-Forwarded-For,
X-Real-IP, or a custom header — so the plugin works correctly behind nginx,
Varnish, a load balancer or a CDN.
When protection is enabled, the plugin installs a tiny must-use loader so the deny check
runs on muplugins_loaded. If the mu-plugins directory is not writable, it falls
back to plugins_loaded.
ufw insert 1 deny from 185.225.69.214 to any.Specifications
Installation
php-firewall folder to /wp-content/plugins/, or install
the zip via Plugins → Add New → Upload Plugin.Frequently Asked Questions
Yes. In the settings, choose the header that carries the real client IP for your setup. Only trust a forwarded header if your server genuinely sits behind that proxy, otherwise the value can be spoofed.
Nothing is blocked and no offenders are collected. Your existing rules are kept.
In three custom tables: cmwpfw_firewall_config,
cmwpfw_firewall_manual_ip_deny_rules and
cmwpfw_firewall_automatic_ip_deny_rules.
Yes. Export the automatic offenders as a ufw script or as CSV from the settings page.
Screenshot