I have this code in my .htaccess folder. This .htaccess folder is in the directory: /api/.htaccess api.php location: /api/api.php
I have this code in the .htaccess:
<Files api.php>
Order deny,allow
Deny from all
Allow from 127.0.0.1
Allow from 122.109.32.241
Allow from 130.211.76.20
</Files>
My goal is to block every one but those IPs. The problem is that Im still getting 403 error even though my IP is on allow.
Error:
Forbidden You don't have permission to access /api/api.php on this server. Apache/2.2.15 (CentOS) Server at accountdispenser.com Port 80
EDIT: Ok after some playing around this method works: $_SERVER['HTTP_X_FORWARDED_FOR'];
But how do I get the .htaccess to work with that method?