Jump to content

Recommended Posts

Posted

My site keeps getting hits for wp-login.php file . I guess its connected to wordpress hack of some sort.  Is there a way to block these hits in htaccess ?

 

thank you

Posted

Add this to your .htaccess file

  # -----------------------------------------------------------------------------------------------
  # 12. Access Restrictions: Keep web users out of dirs that begin with a period,
  # but let services like Lets Encrypt use the webroot authentication method.
  # -----------------------------------------------------------------------------------------------

  RewriteRule "(^|/)\.(?!well-known)" - [F]

  # Block all requests to WP specific files starting with wp- 
  RewriteRule wp-.*\.php$ - [F]

 

  • Like 1
Posted

Where you put the rule matters. Let's try it differently. Remove the previous line and find 15. Access Restrictions section, and change its end from this

  # Block all http access to the default/uninstalled site-default directory
  RewriteCond %{REQUEST_URI} (^|/)site-default/
  # Block all requests to WP specific files starting with wp-
  RewriteRule ^.*$ - [F,L]

into this

  # Block all http access to the default/uninstalled site-default directory
  RewriteCond %{REQUEST_URI} (^|/)site-default/ [OR] # <------- REMEMBER TO ADD [OR] FLAG
  # Block all requests to WP specific files starting with wp-
  RewriteCond %{REQUEST_URI} (^|/)wp-.*\.php$
  # If any conditions above match, issue a 403 forbidden
  RewriteRule ^.*$ - [F,L]

This one blocks all requests ending with wp-xxxx.php and works great on my setup. (Previous method works, too)

image.png.23eae87f07884c03d559b138077f33e4.png

  • Like 1
Posted

Here is an alternative of editing the .htaccess file. You could use Jumplinks from @Mike Rockett and manage all of your 404 hits easily (as well all others redirects needed).

 

OT: about the wp-login itself, you could create a page and a template for this, reproduce the WP login form and play a bit with the "hackers" by giving them a nice memes on login submission :lol:

(last example: https://rockett.pw/jumplinks/examples)

wpt090420001.jpg.9b16a79974cf070dfc25550954de8681.jpg

  • Like 3
  • Haha 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...