【问题标题】:CodeIgniter on Heroku returns 404Heroku 上的 CodeIgniter 返回 404
【发布时间】:2018-02-13 02:34:01
【问题描述】:

默认的 CodeIgniter(当您使用欢迎控制器和视图下载它时)在本地和 Heroku 上都可以正常工作。但是,如果我添加此 official tutorial 的内容,它在我的计算机上仍然可以正常工作,但在 Heroku 上就不行了。

所以这工作正常

$route['default_controller'] = 'welcome';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;

$route['default_controller'] = 'pages/view';
$route['(:any)'] = 'pages/view/$1';

我尝试过的事情:

  • 控制器和模型的首字母大写。
  • $config['base_url'] 设置为我的完整 Heroku URL,包括协议和尾部斜杠。
  • url 添加到$autoload['helper']
  • $config['uri_protocol'] 设置为 REQUEST_URI

我不使用自定义.htaccess

index.php 已运行,但随后仅显示 404 页面。 Pages controller 永远不会被调用。

有人知道吗?

【问题讨论】:

标签: php codeigniter heroku server http-status-code-404


【解决方案1】:

如果您在 Heroku 中使用 Git:Git 默认不识别文件名大小写更改。 使用

git config core.ignorecase false

将文件名的第一个字符设为大写并尝试。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-09-29
    • 2017-01-11
    • 1970-01-01
    • 2019-03-28
    • 2021-05-13
    • 2015-04-20
    • 2016-02-24
    • 1970-01-01
    相关资源
    最近更新 更多