【发布时间】:2021-02-14 02:44:41
【问题描述】:
我只需要在 example.com 和 example.com/index.html 而不是在 example.com/index.php 访问 codeigniter 网站主页,我尝试使用 htacess 将 index.php 重定向到 index.html 但主页变得无法访问.我不想显示它是一个 php 网站。 虽然我可以通过在 application/config/routes.php 中添加以下内容来在 example.com/index.html 上显示主页
$route['index.html'] = 'home/index';
但是 example.com/index.php 仍然可以访问,我想重定向到 404
【问题讨论】:
-
为什么要隐藏您正在使用 PHP 的事实?如果是为了安全,那么通过默默无闻的安全性来说是徒劳的
-
set
$config['url_suffix'] = '.html';,注意:这不会将 index.php 解析为 index.html,但所有其他页面都可以显示为“a_page.html”。你可以完全隐藏(删除)index.php。见codeigniter.com/userguide3/general/urls.html
标签: php .htaccess codeigniter codeigniter-3