How to block Brute Force attacks in wordpress wp-login.php Print

  • 0

WordPress Admin login bruteforce protection, limit by referer

You can protect your WordPress site by only allowing login requests that come directly from your domain name. Simply replace example\.com with your own domain name. Most brute force attacks rely on sending direct POST requests right to your wp-login.php script. So requiring a POST request to have your domain as the referrer can help weed out bots.

RewriteEngine on
RewriteCond %{REQUEST_METHOD} POST
RewriteCond %{HTTP_REFERER} !^http://(.*)?example\.com [NC]
RewriteCond %{REQUEST_URI} ^(.*)?wp-login\.php(.*)$ [OR]
RewriteCond %{REQUEST_URI} ^(.*)?wp-admin$
RewriteRule ^(.*)$ - [F]

Was this answer helpful?

« Back