【问题标题】:Codeigniter Deployed on IP Address Gives 404 On Every Controller Except Index部署在 IP 地址上的 Codeigniter 在除索引之外的每个控制器上都出现 404
【发布时间】:2019-07-20 05:10:45
【问题描述】:

我刚刚在 Amazon Server 上的 IP 地址上部署了 CI。我已将我的 default_controller 设置为自定义控制器。我所有的控制器名称都是大写字母,文件名也是大写的。但是,除了默认控制器之外的所有其他控制器都会给出 404 错误。所有资产和视图等都加载正常。只有控制器给出 404 错误。我已经仔细检查了所有文件名和控制器名称,一切都很好。我不知道是什么原因造成的。服务器上的 Mod 重写也已启用。

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L] 
</IfModule>
  • Mod 重写已启用
  • 控制器和模型命名大写
  • 文件名大写

网址是website url

艾哈迈尔。

【问题讨论】:

  • All my controller names are in capital letters and file names are capital too. - 你的网址也是大写的。,
  • Urls 没有被 captilazied 但 /Home 也不起作用

标签: php apache codeigniter ubuntu mod-rewrite


【解决方案1】:

尝试在 config.php

中为 index_page 设置空值
$config['index_page'] = '';

更新

尝试更新您的 htaccess

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

【讨论】:

  • 那么将 RewriteBase / 添加到您的 htaccess 中怎么样?
  • 你能发布示例ht访问
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2013-03-14
  • 2020-10-19
  • 1970-01-01
  • 1970-01-01
  • 2017-12-29
  • 2021-10-19
  • 2014-05-01
相关资源
最近更新 更多