在Apache中使用目录索引发出Xampp配置?

时间:2017-09-17 21:58:29

标签: php apache xampp

我正在Xampp上运行Apache 2.2并突然开始在启动命令提示符中给出错误说:

AH00526: Syntax error on line 248 of C:/xampp/apache/conf/httpd.conf: Invalid command "<DirectoryIndex", perhaps misspelled or defined by a module not included in the server configuration

..所以我在Xampp配置中检查Apache httpd配置设置中的服务器配置并更改代码:

DocumentRoot "C:/xampp/htdocs"

<DirectoryIndex> index.php index.html

 # Possible values for the Options directive are "None", "All",
# or any combination of:
#   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important.  Please see
 http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks Includes ExecCGI

#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
#   AllowOverride FileInfo AuthConfig Limit
#
AllowOverride All

#
# Controls who can get stuff from this server.
#
Require all granted

</DirectoryIndex>

我尝试关闭&lt;&gt;它只是一直在说同样的错误。 这是Directory索引的define命令的问题吗?如果我需要安装一些额外的依赖项,那么命令提示有什么问题?

1 个答案:

答案 0 :(得分:0)

XAMPP DirectoryIndex示例

对于Apache 2.2

<Directory /path/to/your/directory/ >  
   DirectoryIndex index.html
 </Directory>

示例A:将index.html设置为索引页面,然后将index.php添加到该列表中。

<Directory /foo>
    DirectoryIndex index.html
    DirectoryIndex index.php
</Directory>

示例B:这与示例A相同,不同之处在于使用单个指令完成。

<Directory /foo>
    DirectoryIndex index.html index.php
</Directory>

重新启动 XAMPP Web服务器