开发者

protect folders via htaccess

开发者 https://www.devze.com 2022-12-21 15:40 出处:网络
i want to protect some folders fro开发者_StackOverflow社区m a normal user but i (from localhost or my IP address) m unable to see the folder structure...so i do this

i want to protect some folders fro开发者_StackOverflow社区m a normal user but i (from localhost or my IP address) m unable to see the folder structure...so i do this

write a .htaccess file in that folder(eg.project/cms/js) and write below code

# no nasty crackers in here!
order deny,allow
deny from all
allow from 192.168.1.7

but by using this prohibit to everyone( including me) to see that folder structure..... how do i protect that folder from other users except myself?


I think you got the allow and deny the wrong way around:

order allow,deny
allow from 192.168.1.7
deny from all

which first processes all the allow statements and next the deny statements.


I just checked, your above example works fine for me on my Apache 2. Make sure your IP really is 192.168.1.7. Note that if it's the local machine you're trying to access, your IP will be 127.0.0.1.

0

精彩评论

暂无评论...
验证码 换一张
取 消