appache中如何设置默认访问页?

  

目标:服务器的根目录wwwroot下有三个文件index.php index.html index.htm,要求输入http://localhost时默认访问index.php这个文件。
appache配置方法
不管是Linux版的还是Windows版的配置方法基本一样,在你的安装appache的目录下找到httpd.conf 这个配置文件,
找到以下这段:
<IfModule dir_module>
    DirectoryIndex index.php index.html index.htm
</IfModule>

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

<IfModule dir_module>
    DirectoryIndex index.php
</IfModule>

这种配置会解释 index.php。

需要注意的地方:改动httpd.conf文件后,要重启一下appache。

 

本文首发WBlog博客,欢迎转载!转载请注明本文地址,谢谢。


本文地址:http://www.w3note.com/web/20.html

专注于手机端的app,小程序,H5以及微信公众号提供解决方案
原文地址:https://www.cnblogs.com/ewblgo/p/2708443.html