htaccess to redirect bots trying to access /wp-login.php?action=register

Discussion in 'Apache' started by lucialilj, Oct 16, 2011.

  1. #1
    I have a wordpress blog in a subdirectory called http://mydomain.com/blog. To login I visit /blog/wp-login.php and log in.

    I have noticed that lots of 'bots try out various urls ending with wp-login.php and also wp-signup in screwy places with and without query strings.
    I want to know how to write a single-- or if necessary, multiple-- htaccess redirect that would let me redirect everything ending with 'wp-login.php' that is *not* /blog/wp-login.php/ to a file http://mydomain.com/hello_there.php

    So, for example, I want dynamic addresses like
    http://mydomain.com/blog/author/243/wp-login.php?action=register
    http://mydomain.com/directory/wp-login.php?registration=disabled
    http://mydomain.com/wp-login.php
    All to be sent to http://mydomain.com/hello_there.php.

    I'm clueless about htaccess. But I know the logic is:
    if [ (url is != http://mydomain.com/blog/wp-login.php) AND (url contains wp-login.php -- at end but it might be followed by a query string) ] then [ send to http://mydomain.com/hello_there.php) ]

    I also want the slightly easier
    if[ (url contains wp-signup.php -- at end but it might be followed by a query string) ] then [ send to http://mydomain.com/hello_there.php) ]
     
    lucialilj, Oct 16, 2011 IP
  2. vpslist

    vpslist Peon

    Messages:
    88
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You're making it too difficult.

    You can find a CAPTCHA plugin to cut down a lot of spam.
    You can enable Akismet to cut down 99.9% of the spam
     
    vpslist, Oct 20, 2011 IP
  3. lucialilj

    lucialilj Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    vpslist
    Hmm... my comment didn't appear.
    You are mis-identifying my goal. I have spam totally under control using NOSpamNX which works even better than CAPTCHA and Akismet. I also use Akismet. The file 'hello_there.php' is to help me get these 'bots off my server. Many just load tons of pages over and over. It's a large fraction of server load. I want to block them in htaccess.

    I started identifying and blocking manually, and hello_there.php is helping me block in an automated fashion. This is reducing the load on my server and amount that I consider to be worth the trouble. But I can *see* certain patterns in what 'bots do and I'd like to send a larger fraction of the 'bots to hello_there.php than I am currently sending there.
     
    lucialilj, Oct 21, 2011 IP