为什么从根目录调用index.html而不是index.php?

时间:2015-09-29 07:22:15

标签: php

我的根目录中有两个文件名为' index.html'和' index.php'。 当我浏览localhost / dir_name'它加载' index.html'。为什么' index.php'没有加载到浏览器.. ??

1 个答案:

答案 0 :(得分:0)

如果你想加载index.php,你需要在root代码中使用.httaccess,这应该是

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>