Forum Moderators: rogerd & travelin cat
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} ^(.*)?wp-login\.php(.*)$ [OR]
RewriteCond %{REQUEST_URI} ^(.*)?wp-admin$
RewriteCond %{REMOTE_ADDR} !^xxx\.xxx\.(.*)\.(.*)$
RewriteRule ^(.*)$ - [R=403,L]
</IfModule>
if you just keep blocking ranges of IPs then you are bound to be blocking potential, real site visitors as well eventually.
a. It will not do anything to prevent them from repeated attempts, they will still show in the logs.
b. It does nothing to address harvesters and spambots.
c. Wait for a code repair post from lucy24 shortly. The code is not ideal.
c. ? Excuse my ignorance but what's the issue? It works. :oYes, but it could be more efficient, less work for the server.
<?php
header("HTTP/1.1 403 Forbidden");
?> Oh, so now she's a mind reader too :-PNot at all, I see you were participating here and was pretty sure you would object to the unnecessary use of the
<IfModule envelope and RewriteEngine on and the ^(.*)?wp-login\.php(.*)$ at a minimum.
RewriteEngine on RewriteCond %{REQUEST_URI} ^(.*)?wp-login\.php(.*)$ [OR]
RewriteCond %{REQUEST_URI} ^(.*)?wp-admin$
RewriteCond %{REMOTE_ADDR} !^xxx\.xxx\.(.*)\.(.*)$
RewriteRule ^(.*)$ - [R=403,L]
RewriteCond %{REMOTE_ADDR} !^xxx\.xxx\.\d+\.\d+$
RewriteRule ^(\w+/)?wp-(login|admin) - [F] wp- You don't need an <IfModule> envelope at all, ever.Very true - except that in WordPress, you DO need that envelope to contain the WP generated snippet of htaccess. Remove at your own peril because that is what WP uses to generate settings changes and without its container it may not do what you intended. I found out the hard way that WP does seem to need that container to identify the part it writes to.