Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Redirect unauthorized IP addresses that try to access Wordpress' wp-admin
#REDIRECT UNAUTHORIZED IP ADDRESSES THAT TRY TO ACCESS WP-ADMIN
#
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
# IF YOU WANT INTO THE WORDPRESS ADMIN AREA...
RewriteCond %{REQUEST_URI} ^/wp-admin.*
# AND YOU'RE NOT ON ONE OF THESE IP ADDRESSES...
RewriteCond %{REMOTE_ADDR} !^XX\.XX\.XX\.XXX [NC]
RewriteCond %{REMOTE_ADDR} !^XX\.XX\.XX\.XXX [NC]
RewriteCond %{REMOTE_ADDR} !^XX\.XX\.XX\.XXX [NC]
# THEN YOU'RE FORBIDDEN AND ARE SERVED AN ERROR PAGE TELLING YOU SO
RewriteRule ^.*$ - [L,F]
ErrorDocument 403 https://youtu.be/cQ_b4_lw0Gg
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.