Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

htaccess allow from 127.0.0.1 not working

I am using XAMPP on windows 7. I put this htaccess file in my htdocs folder and I'm getting access denied when I try to open http://localhost/.

Order allow,deny
Allow from 127.0.0.1
Allow from ::1
Deny from all

I want to deny access to any computers other than this one. How can I do this?

like image 921
php_nub_qq Avatar asked Mar 18 '23 15:03

php_nub_qq


1 Answers

Precedence is everything!

If you allow localhost to connect, and afterwards deny ALL ips, the deny overwrites the allow.

So you'd first apply the blacklist (deny all) and then the whitelist (allow localhost).

Order deny,allow # <--- order to apply the white/blacklist change
Allow from 127.0.0.1
Allow from ::1
Deny from all

http://httpd.apache.org/docs/2.2/howto/access.html

The Order directive goes hand-in-hand with these two, and tells Apache in which order to apply the filters.

like image 189
Daniel W. Avatar answered Mar 29 '23 05:03

Daniel W.