To block access except for a single IP address in the .htaccess file the code is:
1 2 3 |
order deny,allow deny from all allow from 1.1.1.1 |
If you’re behind a load balancer then you have to use the X-Forwarded-For header instead:
1 2 3 4 |
Order Deny,Allow Deny from all SetEnvIf X-Forwarded-For "^1\.1\.1\.1" AllowAccess Allow from env=AllowAccess |