Skip to content

Instantly share code, notes, and snippets.

@BenRacicot
Created March 7, 2018 19:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BenRacicot/5a919252559a704e305bc3e476ca81d3 to your computer and use it in GitHub Desktop.
Save BenRacicot/5a919252559a704e305bc3e476ca81d3 to your computer and use it in GitHub Desktop.
Disaalow anyone except your network IP to access wp-admin login page (or any page) via .htaccess file
# Only allow internal IP to access login page
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} ^(.*)?wp-login\.php(.*)$ [OR]
RewriteCond %{REQUEST_URI} ^(.*)?wp-admin$
RewriteCond %{REMOTE_ADDR} !^xx.xxx.xx.xxx$
RewriteRule ^(.*)$ - [R=403,L]
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment