Priority, HTML and PHP Index File

I put the index.html file and the index.php file in the root directory of my site together, when I go to my site, www.site.com, it serves the php file instead of the html file, my question is why? Why does it serve php over html? Apache server.

+4
source share
2 answers

Check the DirectoryIndex Apache directive.

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

for instance

DirectoryIndex index.html index.php 

Will try to run html first, if it does not exist, it will serve php.

+6
source

Apache may say that it prefers a .php or .html file.

Look for such a section in the configuration file.

 DirectoryIndex index.php 

and change it to

 DirectoryIndex index.html 
+1
source

Source: https://habr.com/ru/post/1369135/


All Articles