【问题标题】:URL routing in codeigniter must include '?' to workcodeigniter 中的 URL 路由必须包含“?”去工作
【发布时间】:2012-11-27 07:49:09
【问题描述】:

所以我使用默认配置安装了 CI,并输入了 [示例代码] https://www.codeigniter.com/user_guide/tutorial/static_pages.html

我尝试通过 localhost/codeigniter/index.php/pages/view 访问该页面,而 apache 给了我“找不到 - 找不到您请求的 URL”错误。

但如果我输入 localhost/codeigniter/index.php?/pages/view,它就可以工作!

我尝试将 application/config/config.php 中的基本 url 更改为空白,“http://localhost/”和“http://localhost/codeigniter/”,但仍然没有效果。

我已经用谷歌搜索并查看了用户指南,但仍然没有找到解决方案。

我必须在哪里看,我错过了什么? 感谢您的帮助。

【问题讨论】:

  • 你不应该需要 ?,让它工作,不。由于您的子文件夹用完了 codeigniter,您可能希望将 base_url 设置为 http://localhost/codeigniter/
  • 您能否发布您的.htaccess 文件,您可能需要进行调整以说明您使用的/codeigniter/ 子文件夹。

标签: php apache codeigniter


【解决方案1】:

如果在 Apache 中关闭了 AcceptPathInfo,就会发生这种情况。尝试检查您的 Apache 配置中的该指令,或者手动将其设置为 On

【讨论】:

  • 谢谢!我在我的 ubuntu 的 apache2.conf 中添加了“AcceptPathInfo On”,重新启动,它马上就可以工作了
猜你喜欢
  • 2016-07-13
  • 2019-03-15
  • 2016-04-05
  • 2014-12-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多