Is it possible to block any users IP if they try to access a specific URL such as /wp-login.php page which does not exist on Drupal.

Basically to automatically blacklist the user, for days or even forever.

Trying to implement this as a security measure. For those who are looking for ways to hack the site.

2 Answers 2


You can use autoban ip

You have to at least enable Autoban and Autoban Core Ban Provider modules from this package.

Then go to configuration > people > automatic ip address bans and add a rule with this settings

type page not found

Message pattern wp-login.php|/otherURL|anotherURL

pattern (can be left blank)

Threshold 1 (after how many attempts to ban them)

IP Ban Provider Core Ban

NOTE: above I have added multiple patterns delimited with | just to demonstrate the possibility

After setting this everytime your cron runs this module will run and it will look through the watchdog messages and ban the IPs that match the above rule.


Aside from banning the IP in Drupal, another thing you can do is add settings in your server to automatically deliver 404s for any Wordpress URLs, or URLs related to other software. This way, Drupal is never called.

Which way you want to go will depend on your application, and how critical it is to save resources in regard to bots that are more or less combing the WHOIS domain list.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.