首页 > 开发 > Apache > 正文

apache怎么设置默认首页?

2020-10-12 18:48:45
字体:
来源:转载
供稿:网友

如果我们刚安装好apache之后一般情况默认首页是index.html,index.htm这两种了,如果我让它默认访问的不是这两个文件,而如index.php或abc.php文件呢,这个要怎么改?下面是配置默认主页的方法。

apache配置方法:

不管是Linux版的还是Windows版的配置方法基本一样,在你的安装apache的目录下找到httpd.conf 这个配置文件,找到以下这段:

  1. <IfModule dir_module> 
  2.     DirectoryIndex index.php index.html index.htm 
  3. </IfModule> 

在DirectoryIndex  后面写上你要设置的默认主页index.php名称就可以了,如下:

  1. <IfModule dir_module> 
  2.     DirectoryIndex index.php  
  3. </IfModule> 

这种配置会解释 index.php,需要注意的地方:改动httpd.conf文件后,要重启一下apache。

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表