Skip to content

Instantly share code, notes, and snippets.

@gregrickaby
Created August 31, 2014 14:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save gregrickaby/7929e7d53b082ffe313f to your computer and use it in GitHub Desktop.
Save gregrickaby/7929e7d53b082ffe313f to your computer and use it in GitHub Desktop.
Lock down WordPress Dashboard login with .htaccess
# APACHE .HTACCESS
# This will deny all traffic (except yours) to /wp-admin (including wp-login.php)
# It will also return a 403 forbidden error.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} ^(.*)?wp-login\.php(.*)$ [OR]
RewriteCond %{REQUEST_URI} ^(.*)?wp-admin$
RewriteCond %{REMOTE_ADDR} !^111\.222\.333\.444$
RewriteRule ^(.*)$ - [R=403,L]
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment