htaccess规则使index.php而不是index.html在转到http://localhost.



有人能提供一个.htaccess规则,让我的index.php覆盖我的index.html吗?

这意味着当我转到http://localhost时,将提供index.php,而不是index.html。

这将完成任务:

DirectoryIndex index.php index.html

如果没有index.php,则会提供index.html文件。

这可能会起作用。。。

RewriteEngine On
RewriteBase /
RewriteRule ^index.html$ index.php [R=301,L]

在apache配置文件(或.htaccess)中,将DirectoryIndex设置为index.php,而不是index.html

以下是一个示例:http://www.javascriptkit.com/howto/htaccess6.shtml

相关内容

最新更新