Reputation: 11
I am trying to limit access to one subdirectory from only two specific IP addresses. I have tried
Require ip <my ip>
and
Order allow,deny
allow from <my ip>
and
order allow,deny
deny from all
allow from MyIP
Tried again
<RequireAny>
Require ip <my ip>
Require ip <my ip>
</RequireAny>
After adding any of those restrictions into my htaccesss I am getting Forbidden error. How can I allow access only from my two IPs?
my vhost has these lines, do you think I did any mistake here?
<Directory /home/mysite/>
AllowOverride All
Require all granted
</Directory>
Upvotes: 0
Views: 3043
Reputation: 95
make sure you are using one of the following directives only ,not the both at the same time across all the conf files of apache: either :
Require all denied
Require ip 14.14.14.14 50.50.50.50
or
Order deny,allow
Deny from all
Allow from 14.14.14.14, 50.50.50.50
if you mix them you'll get 403 (you use one across all configuration files ).
Also , check your ip , make sur you are not using a NAT solution or using a reverse proxy. you can see you ip in your access_log if you have configured them
Upvotes: 2