London Office 128 City Rd, EC1V 2NX UK

Restricting Access via .htaccess (Technical Method)

If your website is hosted on an Apache server (which is very common), you can use the .htaccess file to block or allow connections based on the IP address.

  1. Connect to your server using FTP or your hosting control panel’s File Manager.
  2. Navigate to the /wp-admin/ directory of your WordPress installation.
  3. Create or Edit a .htaccess file in this directory.

Add the following code to the .htaccess file, replacing the example IPs with your actual IP addresses:

Apache

# Protect wp-admin - Deny all, then Allow specific IPs
Order Deny,Allow
Deny from all

# Allow your personal or VPN IP address(es)
Allow from 192.168.1.100  # Replace with your first IP address
Allow from 203.0.113.42   # Replace with your second IP address (e.g., VPN IP)

What this code does:

Save the file. This will immediately enforce the IP restriction for the /wp-admin/ folder and its contents.