Settings | Sign in | Sign up

There are currently 3 posts.

【Apache】通过.htaccess文件去掉单独一个文件的密码访问(HTTP Authentication 401)

Floor 1 巨大八爪鱼 8/7/14 19:04
比如整个网站已经设置了访问密码,但现在我需要解锁一个特殊的文件,要求不需要任何用户名和密码就能访问这个文件,而访问其他文件仍然需要输入用户名和密码。假设这个文件是ajax/upload.php,可以在ajax目录下再建立一个.htaccess,写上:
<Files "upload.php">
Satisfy Any
</Files>
注意引号内绝对不能出现斜杠“/”,也就是说不能指定子目录的文件,只能指定.htaccess文件所在目录的文件。

然后重启ie浏览器,访问http://localhost/,需要密码
而访问http://localhost/upload.php,则不需要密码
Floor 2 巨大八爪鱼 8/7/14 19:08
有一个错误,改一下:
然后重启ie浏览器,访问http://localhost/,需要密码
而访问http://localhost/ajax/upload.php,则不需要密码
Floor 3 巨大八爪鱼 8/7/14 19:18

Content converter:

Reply the post
Content:
User: You are currently anonymous.
Captcha:
Unclear? Try another one.
©2010-2025 Purasbar Ver3.0 [Mobile] [Desktop]
Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported license.