开发者

Precedence, HTML and PHP Index File

开发者 https://www.devze.com 2023-03-31 12:56 出处:网络
I put an index.html file and an index.php file in the root directory of my site together, when I navigate to my开发者_如何学运维 site, www.site.com, it serves the php file instead of the html file, my

I put an index.html file and an index.php file in the root directory of my site together, when I navigate to my开发者_如何学运维 site, www.site.com, it serves the php file instead of the html file, my question is why? Why does it serve the php over html? Apache server.


Check the DirectoryIndex directive of Apache.

http://httpd.apache.org/docs/2.0/mod/mod_dir.html

For instance

DirectoryIndex index.html index.php

Will try to serve first the html, if it doesn't exist it will serve the php.


Apache can be told to prefer the .php or the .html file.

Look for a section like this in the configuration file.

DirectoryIndex index.php 

and change it to

DirectoryIndex index.html
0

精彩评论

暂无评论...
验证码 换一张
取 消