php - 如何制作默认页面 home.php 而不是 index.html 和 index.php

标签 php .htaccess

我有网站http://mywebsite.com如果我点击这个 URL,它会将 index.php 和 index.html 作为默认页面。如何将 home.php 设为默认页面。 我试过这个但没有通过将以下代码放在 public_html 的 .htaccess 文件中来工作

DirectoryIndex home.php index.html index.php

最佳答案

您只需要在您的 DirectoryIndex 中添加 home.php 即可使其正常工作。请记住,这是在您的根项目的 .htaccess 文件中使用的:

DirectoryIndex home.php

关于php - 如何制作默认页面 home.php 而不是 index.html 和 index.php,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15779198/

相关文章:

nginx - 使用 Nginx Web 服务器的 FastCgi 与 PHP-FPM

javascript - WordPress Javascript 问题

php - 类别表和工厂表之间的关系 Codeigniter

php - 使用 Haraka 邮件服务器配置 PHP

php - 当回显 html 标签时,输出会打印出所有内容

.htaccess - 通过 htaccess 从 url 中剥离 utm_source 然后重定向到原始 url

php - 使用环境变量覆盖核心 Magento DB 连接

php - 通过 .htaccess 更改根文件夹

.htaccess 将所有请求(ssl 和非 ssl)重定向到 https ://domain. com

.htaccess - htaccess - HTTP 到 HTTPS 和 .HTML 到/