开发者

.htaccess deny access to folder

开发者 https://www.devze.com 2023-01-26 00:38 出处:网络
I\'m new to apache... so be gentle with me guys :-) I have used the following for denying access to a web folder with .htaccess:

I'm new to apache... so be gentle with me guys :-)

I have used the following for denying access to a web folder with .htaccess:

order deny,allow
deny from all

I'm getting the "forbidden" page which is ok because I don't want web users, spiders or scrapers to access this folder.

But I am no longer able to access web folder though php script that I have w开发者_开发百科ritten. I thought that the applications where an exception to this.

Any help would be greatly appreciated by this newbie...

Thx...


I might be wrong , go to check your ip address with myipaddress.com or whatever. Then you can deny from all and allow from <YOUR IP>


You might try using HTTP basic authentication to protect your files, but allow exceptions by providing a username and password in your PHP applications call. It's very simple, here is example for file_get_contents function: http://www.electrictoolbox.com/php-file-get-contents-sending-username-password/.

You should add something like this to your .htaccess and remove other restrictions:

AuthType Basic
AuthName "Restricted Files"
AuthUserFile /usr/local/apache/passwd/passwords
Require user wizztjh

Here is more info on this from apache docs: http://httpd.apache.org/docs/2.0/howto/auth.html

0

精彩评论

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