Blocking Everyone from Accessing WordPress Login Page


This will block everyone (including yourself) from accessing your WordPress login page:

# BLOCK EVERYONE FROM LOGIN PAGE INCLUDING MYSELF

RewriteEngine on
RewriteCond %{REQUEST_URI} ^(.*)?wp-login\.php(.*)$ [OR]
RewriteCond %{REQUEST_URI} ^(.*)?wp-admin$
RewriteRule ^(.*)$ - [R=403,L]

This goes to .htaccess file that is located in the root folder of your site. It’s possible to exclude yourself by adding your IP address, but for sites I never touch I prefer it this way.