Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/delphi/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
.htaccess 将子目录重写为index.html_.htaccess - Fatal编程技术网

.htaccess 将子目录重写为index.html

.htaccess 将子目录重写为index.html,.htaccess,.htaccess,我有一个子目录设置,里面有一个静态网站 但是当我转到www.site.com/directory/时,它不会显示索引页面,只有www.site.com/directory/index.html起作用 有没有办法让.htaccess重写这个 我不能只转发所有URL,因为还有其他页面(如www.site.com/directory/other.html)仍然需要工作。在Apache配置中,您应该启用AllowOverride,以便可以在.htaccess中设置不同的选项。在该文件中,您可以设置Dir

我有一个子目录设置,里面有一个静态网站

但是当我转到www.site.com/directory/时,它不会显示索引页面,只有www.site.com/directory/index.html起作用

有没有办法让.htaccess重写这个


我不能只转发所有URL,因为还有其他页面(如www.site.com/directory/other.html)仍然需要工作。

在Apache配置中,您应该启用
AllowOverride
,以便可以在
.htaccess
中设置不同的选项。在该文件中,您可以设置
DirectoryIndex
指令

见:
http://httpd.apache.org/docs/2.2/mod/core.html#allowoverride

/directory/
中放置一个带有以下指令的.htaccess文件就足够了:

DirectoryIndex index.html

如果它仍然不起作用,可能还有其他服务器指令与之冲突。

谢谢,这正是我想要的。