Search code examples
.htaccesshttp-status-code-403

.htaccess IP address whitelist not working, still receive 403 forbidden


A corporate client has IP address xxx.xxx.xxx.xxx/32

I've added the following to /wp-admin/.htaccess:

order deny,allow
allow from xxx.xxx.xxx.xxx/32
deny from all

However, when an employee on the corporate network accesses www.example.com/wp-admin, they receive a 403 forbidden error.

If they visit www.whatismyip.com, they're told their IP address is the same as above.

Help appreciated.

EDIT:

www.example.com/.htaccess also contains the following:

<Files wp-login.php>
order deny,allow
allow from xxx.xxx.xxx.xxx/32
deny from all
</Files>

Solution

  • Should go in order because 'deny from all' is the last rule in your example. Try this:

    Order Deny,Allow
    Deny from all
    Allow from 111.111.111.111