Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache htaccess文件、用户登录和服务器访问_Apache_.htaccess_Local - Fatal编程技术网

Apache htaccess文件、用户登录和服务器访问

Apache htaccess文件、用户登录和服务器访问,apache,.htaccess,local,Apache,.htaccess,Local,我试图使用.htaccess文件阻止对web服务器目录(包括子目录)的访问,除非用户登录或宿主服务器试图访问文件 更清楚地说,受保护的目录是网站的管理目录。 在该目录中,有一些文件由站点所在的服务器通过http调用 服务器正在运行Apache 2.2.24 这就是我迄今为止所尝试的: AuthType Basic AuthName "Password Protected Area" AuthUserFile /..fakepath../.htpasswd Require valid-user O

我试图使用.htaccess文件阻止对web服务器目录(包括子目录)的访问,除非用户登录或宿主服务器试图访问文件

更清楚地说,受保护的目录是网站的管理目录。 在该目录中,有一些文件由站点所在的服务器通过http调用

服务器正在运行Apache 2.2.24

这就是我迄今为止所尝试的:

AuthType Basic
AuthName "Password Protected Area"
AuthUserFile /..fakepath../.htpasswd
Require valid-user
Order Deny,Allow
Deny from all
Allow from localhost
Satisfy Any
用户可以登录,但服务器无法访问文件。
我在想,也许我不能将服务器引用为localhost?

而不是localhost提供主机提供商的外部IP。它确实与外部IP地址一起工作。如果提供商更改服务器的IP或其他什么,最好有一个更可靠的解决方案。通常托管公司有静态IP,所以这种情况不应该经常发生。您还可以托管它们的主机名而不是IP,这不会改变。