No need to hire SEO experts anymore to fix your site technical SEO issues


How To Limit Access by IP to Your wp-login.PHP File in WordPress

by Jay | Posted on January 11th, 2023

Are you a WordPress user looking to keep your site secure?

If so, this blog post is for you. We will be discussing how to limit access to your wp-login.php file by IP address in order to prevent unauthorized users from accessing sensitive information. Read on for the details!

wordpress login page

Hackers could easily access your website by using your WordPress login page. Such attacks can be successfully prevented by restricting access to particular IP addresses.

Here are several easy methods for restricting IP access to your WordPress wp-login.php file.

Determine Who Will Have Access

Once you have identified who should have access to your wp-login.php file, it’s time to take the necessary steps to secure it. The first step is to whitelist the IP addresses of those who should have access. You can do this by editing your .htaccess file and adding the IP addresses you wish to allow.

This will prevent anyone with an IP address not on the list from accessing your login page. However, if your IP address changes frequently or if you access your site from multiple locations, another approach may be necessary.

Using IP address 

You need to edit the .htaccess file by adding some code to use this technique. 

Your website’s root folder has a unique server configuration file called .htaccess, which can be viewed using the File Manager tool in your WordPress hosting control panel or FTP.

Use an FTP program to connect to your WordPress website, then add the following code at the top to update your .htaccess file.

<Files wp-login.php>

        order deny,allow

        Deny from all

# whitelist Your own IP address

allow from

#whitelist some other user's IP Address

allow from

Remember to substitute your IP addresses for the XXs. By going to the What’s my IP address webpage, you can quickly determine your IP address.

You can request the IP addresses of other users if they need to log in to your site with them. Then you can also include those in the .htaccess file.

The wp-login.php file can now be accessed, and people with these IP addresses can log into your website.

Changing the admin URL

The entirety of the code that generates the login page is, by default, contained in the “wp-login.php” file. The login steps are also managed by it. The “wp-login.php” code can be used in your new file.

The name of your “wp-login.php” file can be changed in a more clever method, and it will finally change your login URL. You simply need a text editor and access to your website’s files.

  • Creating a New File: Make a new file in your text editor after opening it. Now, save it in the root folder. Whatever you wish to see in place of your login URL, give it the name.
  • Copy and paste the code: The code must be copied into the new file after being selected in the “wp-login.php” file and opened. Remember to save it.
  • Find and replace the “wp-login.php” string: You need to search the file for every instance of “wp-login.php” and replace it with the name of your new file. The “find and replace” tool in Notepad++ can be used to speed up your work.

Test Your New Login URL: Ultimately, you ought to be able to log in by navigating to your new URL. Anyone attempting to access the /wp-admin directories or /wp-login.php will now see a 404 Not Found page. To be sure you’ve covered all the bases for your WordPress security, download the Ultimate WordPress Security Checklist.

Install the Restricted Site Access Plugin

You can also use a plugin called Restricted Site Access plugin. This plugin allows you to easily whitelist the IP addresses of those who will be allowed access to your site. The plugin also helps to secure your WordPress website by blocking access to wp-login.php, creating a secret login URL, and blocking access to wp-admin.

It also provides additional security measures, such as limiting failed login attempts and redirecting blocked IP address access. With this plugin, you can easily set up your WordPress site with an extra layer of security.

Now that you have installed the Restricted Site Access plugin, it’s time to whitelist your IP address. This will allow you to access the wp-login.php file from your own computer and any other IP addresses you choose to whitelist.

To do this, go to Settings > Reading in your WordPress dashboard. Scroll down to the “Restricted site access” section and check the box next to “Enable restricted site access.” Then, select “Whitelisted IP addresses” from the drop-down menu and enter your IP address (or multiple IP addresses if you have multiple users who need access) in the field below.

Once you have entered your IP address(es), click “Save Changes” at the bottom of the page.


By keeping track of login attempts using your server logs, you can easily identify suspicious IP addresses and take action against them. You can also use a WordPress login attempts plugin to monitor login attempts, change the URL of the login page, and restrict access to wp-admin.

In order to keep your WordPress website secure, it’s important to regularly review and update your security settings. This means not only making sure that all of your plugins are up-to-date but also reviewing the settings you have in place to limit access by IP to your wp-login.php file. Make sure that any IP addresses you have whitelisted are still active and if not, remove them.

Additionally, if you need to grant access to someone new, be sure to add their IP address to the list so they can log in but keep access limited. Finally, monitor logins for any unauthorized access attempts and take measures as necessary to prevent them.


I've worked for WooRank, SEOptimer, and working on a cool SEO audit tool called Now I have build Linkilo and SEO RANK SERP WordPress theme. I've been in the SEO industry for more than 5 years, learning from the ground up. I've worked on many startups, but also have my own affiliate sites.


No need to hire SEO experts anymore to fix your site technical SEO issues