Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.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
Php 无法访问“a”;“错误”;subdomain.localhost中的文件夹/error/_Php_Apache_.htaccess - Fatal编程技术网

Php 无法访问“a”;“错误”;subdomain.localhost中的文件夹/error/

Php 无法访问“a”;“错误”;subdomain.localhost中的文件夹/error/,php,apache,.htaccess,Php,Apache,.htaccess,我正在尝试将所有错误文档放在网站根目录中的一个文件夹中 理想情况下,我希望所有的错误文档都进入http://subdomain.localhost/error/但每当我在浏览器中加载URL时,就会收到一条消息禁止访问错误403 然后,我从文档根目录中删除了.htaccess文件。.htaccess文件的内容是: ErrorDocument 403 /err_docs/401 ErrorDocument 401 /err_docs/401 ErrorDocument 404 /err_docs/4

我正在尝试将所有错误文档放在网站根目录中的一个文件夹中

理想情况下,我希望所有的错误文档都进入
http://subdomain.localhost/error/
但每当我在浏览器中加载URL时,就会收到一条消息
禁止访问
错误403

然后,我从文档根目录中删除了
.htaccess
文件。
.htaccess
文件的内容是:

ErrorDocument 403 /err_docs/401
ErrorDocument 401 /err_docs/401
ErrorDocument 404 /err_docs/404
ErrorDocument 500 /err_docs/500

IndexIgnore * # prevent directory listing

Order deny,allow
Allow from *
/err\u docs/
是我的错误文档的当前文件夹-(因为
/error
不起作用)

检查apache错误日志后,我发现:
[Thu Jun 25 13:46:57.445385 2015][autoindex:error][pid 5104:tid 1760][client 127.0.0.1:51853]AH01276:无法为目录C提供服务:/xampp/apache/error/:没有匹配的目录索引找到了(index.php、index.pl、index.cgi、index.asp、index.shtml、index.html、index.htm、default.php、default.pl、default.cgi、default.asp、default.shtml、default.html、default.htm、home.php、home.pl、home.cgi、home.asp、home.shtml、home.html、home.htm)以及Options指令禁止的服务器生成的目录索引

我尝试了以下方法:

  • 已从文档根目录中删除
    .htaccess
    (从子域和域中删除)
  • 检查apache文件夹中是否没有另一个
    .htaccess
    文件
我很高兴能在谷歌上找到结果,但我不知道该搜索什么。有谁能告诉我从哪里开始寻找这个问题,或者应该寻找什么

更新 这是我的虚拟主机配置文件的内容:

NameVirtualHost localhost:80
<VirtualHost *:80>
<Directory "C:\web">
    Options Indexes FollowSymLinks MultiViews Includes ExecCGI
    AllowOverride All
    Order Allow,Deny
    Allow from all
    Require all granted
</Directory>
ServerName localhost
ServerAlias localhost
DocumentRoot "C:\web"
</VirtualHost>

#######################################

NameVirtualHost localhost:80
<VirtualHost *:80>
<Directory 'C:\\Personal\\Web'>
    Options Indexes FollowSymLinks MultiViews Includes ExecCGI
    AllowOverride All
    Order Allow,Deny
    Allow from all
    Require all granted
</Directory>
ServerName personal.localhost
ServerAlias personal.localhost
DocumentRoot 'C:\\Personal\\Web'
</VirtualHost>

#######################################
NameVirtualHost本地主机:80
选项索引如下SYMLINKS多视图包括ExecCGI
允许超越所有
命令允许,拒绝
通融
要求所有授权
服务器名本地主机
服务器别名本地主机
DocumentRoot“C:\web”
#######################################
NameVirtualHost本地主机:80
选项索引如下SYMLINKS多视图包括ExecCGI
允许超越所有
命令允许,拒绝
通融
要求所有授权
ServerName personal.localhost
ServerAlias personal.localhost
DocumentRoot'C:\\Personal\\Web'
#######################################

我今天遇到了完全相同的问题。在谷歌搜索时,我问了这个问题。由于问题没有答案,而且没有任何评论对我有帮助,我问了一个新问题,我的观察结果是,/error是从ServerRoot而不是DocumentRoot提供的。在评论中,我得到了一个检查错误的建议n/error的别名。最后,我在文件xampp/apache/conf/extra/httpd multilang errordoc.conf中获得了别名。注释
alias
指令可以访问文档根目录中的error文件夹。请注意,注释别名可能会产生副作用,因为/error文件夹文件在其他目录中有许多用途er配置文件主要用于定义
ErrorDocument

使用名为
error
的文件夹使用上述
.htaccess
文件对我来说很好。您是否确实将相应的错误文档放置在文件夹中,例如401、404和500?@Cyclone?我认为问题不在于
.htaccess
文件,bec因为如果我从目录中删除该文件,我仍然无法访问该文件夹。我确定问题出在其他地方,但我不确定问题出在哪里,但我作为该社区的成员已经足够长的时间,知道有人会要求查看
.htaccess
文件。您对提供错误文档的文件夹设置了哪些权限?@cycle一个完整权限,我没有拒绝任何其他权限,因为我在我的站点代码文件中执行所有验证(以防止不必要的访问)。我也是这台计算机上的管理员,并且我没有启用UAC(Windows 7和XAMPP)尝试重新启动您的服务器,可能它没有接收到您的
.htaccess
文件的更新。