Apache 如何设置默认首页文档

在你安装后的Apache目录下,有一个conf目录,在这个目录里,有一个"httpd.conf"文件.我们要做的,就是修改这个文件。

在这个文件里,凡是以"#"开头的每一行,都是无效的,如果你想让你的设置起作用,就要把行首的"#"去掉。

找到 DirectoryIndex 这段.把它改成DirectoryIndex index.php index.Html index.html 这样,你的网站目录的默认首页是 index.php, 如果没有index.php系统会自动寻找index.html、html做为默认首页了。

注意事项:index.php index.Html之间要有一个空格

另外你还可以操作一下其它的:

找到 ServerRoot 这段.将它设成你的Apache安装目录,我的是 ServerRoot "D:/Apache Group/Apache2"

找到 DocumentRoot 这段.把他设成你网站的根目录,我的是 DocumentRoot "D:/Apache Group/web。

不允许评论