当前位置: 主机百科 » 资源 » 技术 » 正文

apache设置网站默认首页文档的方法

apache设置网站默认首页文档的两种方法:

一、修改apache配置文件

找到apache配置文件:httpd.conf,找到 DirectoryIndex 参数,将你想要的默认首页文档名称加入其中即可。例如:DirectoryIndex index.html index.php default.html,这样apache会自动按顺序查找网站根目录中的相应文件,第一个匹配值就会作为默认首页文档被显示出来。

二、通过vhost配置

示例代码如下:

1
  &lt;VirtualHost *:80&gt;  ServerAdmin webmaster@02405.com  DocumentRoot &quot;D:wampwww&quot;  ServerName 02405.com  ServerAlias 02405.com  <span style=“color:#ff0000;”>DirectoryIndex wap.php</span>  ErrorLog &quot;logs/dummyhost.localhosterror.log&quot;  CustomLog &quot;logs/dummyhost.localhostaccess.log&quot; common  &lt;/VirtualHost&gt;

上述代码中通过DirectoryIndex将02405.com这个网站的默认首页文档单独配置成了wap.php

未经允许不得转载:主机百科 » apache设置网站默认首页文档的方法

相关文章