How to whitelist ip for the login page

How to whitelist ip for the login page and redirect everyone else.

  • James Dunn

    Goodday @AnnI@Annabelle

    This is actually pretty simple - as long as you don't mind poking around in your .htaccess file. If you are cool with that simply open your main .htaccess file and put this code at the very top of the file before everything else:

    01 <Files wp-login.php>
    02 order deny,allow
    03 Deny from all
    05 # whitelist Your IP address
    06 allow from
    08 </Files>

    This will block everyone from accessing your wp-login.php file but will allow you to access it from your IP address.

    Now, to my questions:

    1) Are you on a static IP address?

    If not, the moment your IP address changes, you will not be able to login to your site. You'll have to access your .htaccess file again and change to your new IP address.

    2) Why do you want to do this?

    Is it for added security? Wouldn't you be better off just installing the Limit Login Attempts plugin or something like that?

    Are you trying to hide your login screen so that no one knows it's a WordPress website? If so, then you can just reconfigure the login screen to have your or your client's logo on it and use Ozh' Login plugin to change the login page to instead of

    Good luck and post back to let us know what you decide to do. I'd also like to get the answers to my questions because it will help me better understand what you're trying to accomplish.


    James Dunn
    Athens, GA USA

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.