Home / Wordpress / Block Access to WordPress WP-Admin

Block Access to WordPress WP-Admin

If you are care about your wordpress, you can refer to my tutorial to protect your wordpress admin by allow login use your own ip or vpn. This is one of many ways to protect and lock down your WordPress dashboard from unauthorized access or hackers who might want to hack into your WordPress admin site.

Please refer video below how to protect your wordpress like me.

As soon as you understanding how to work with nginx, open the WordPress site configuration file and add the below block of code into the file and save it.

  • Change allow 116.XXX.XXX.XXX; to your own ip.
  • Delete unwanted allow 104.XXX.XXX.XXX; and allow 98.XXX.XXX.101; if you only own 1 ip.
  • Change rewrite ^(.*) https://www.levelcore.com permanent; to your redirect page.
        location ~ ^/(wp-admin|wp-login\.php) {
                allow 116.XXX.XXX.XXX;
                allow 104.XXX.XXX.XXX;
                allow 98.XXX.XXX.101;
                deny all;
                error_page 403 = @wp_admin_deny;
        }

        location @wp_admin_deny {
                rewrite ^(.*) https://www.levelcore.com permanent;
        }

        location /wp-admin/admin-ajax.php {
                allow all;
        }