Can anyone help with a regular expression problem? (Wordpress site)

Clinton

Free Member
  • Business Listing
    Jan 17, 2010
    5,748
    1
    3,068
    ukbusinessbrokers.com
    I have the Jorgee bot blocked in htaccess via a mod_rewrite ... but it doesn't seem to be working. :(

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP_USER_AGENT} xenu [NC,OR]
    RewriteCond %{HTTP_USER_AGENT} ZmEu [NC,OR]
    RewriteCond %{HTTP_USER_AGENT} Jorgee [NC]
    RewriteRule !^robots\.txt$ - [F]
    </IfModule>

    I'm still seeing Jorgee in my Wordfence "Live Traffic" view ... and it's hitting hundreds of pages! If it's blocked in htaccess, each of those Jorgee requests shouldn't even be loading WP, should it? How come Jorgee is still appearing in the Wordfence live view logs?

    I've got a block in Wordfence itself for Jorgee, but it's such a badly behaved bot that I don't want it even getting that far (as that involves executing the WP code for every stupid page request it makes).

    Any suggestions?
     

    Xpress Docs

    Free Member
    Sep 6, 2017
    11
    2
    Sneakily, it looks like the user agent isn't just Jorgee. A quick look around the net indicated that this change to your original post should work (until said user agent is changed)

    RewriteCond %{HTTP_USER_AGENT} Mozilla/5\.0\ Jorgee [NC]

    My regex isn't great, but maybe dropping the mozilla part, and using Jorgee$ would be a better option?
     
    Last edited:
    Upvote 0

    Clinton

    Free Member
  • Business Listing
    Jan 17, 2010
    5,748
    1
    3,068
    ukbusinessbrokers.com
    RewriteCond %{HTTP_USER_AGENT} Mozilla/5\.0\ Jorgee [NC]

    My regex isn't great...

    Thanks, I've seen that version online as well ...but that doesn't work either (maybe it is, as you suggest, the syntax).

    My htaccess works fine for everything else (so it's not the mod_rewrite that's the problem).
     
    Upvote 0

    Xpress Docs

    Free Member
    Sep 6, 2017
    11
    2
    I only asked about the raw logs, as it may have been something sneaky with the use of white space in the user agent string. That doesn't seem to have any. The only other syntax that I can find that makes any sense is

    RewriteCond %{HTTP_USER_AGENT} ^.*(jorgee).* [NC]
    RewriteRule ^(.*)$ - [L,R=403]

    This should give jorgee an access forbidden message as well, rather than divert it to your robots.txt file.
     
    Upvote 0

    Latest Articles