【问题标题】:Moved CodeIgniter Script Doesn't work properly移动的 CodeIgniter 脚本无法正常工作
【发布时间】:2014-07-03 18:40:46
【问题描述】:

我在重新安装 Codeıgniter 脚本时遇到问题。

在我的一个网站中,脚本可以工作,但是当我将此脚本带到我的另一个域时,它就不起作用了。

Working URL : istoc.immobulus.com
Non-Working : modoko.modokoapp.com

到目前为止没有问题,但是当我输入 admin 时它不起作用。

Working URL : istoc.immobulus.com/admin/
Non-Working : modoko.modokoapp.com/admin/

我已经相应地更改了 db 和 root URL 你认为我错过了修改脚本中的其他部分吗? 为什么会出现这个错误?

PS。在日志中我没有收到任何错误


DEBUG - 2014-07-03 21:30:38 --> Hooks 类已初始化
调试 - 2014-07-03 21:30:38 --> Utf8 类已初始化
调试 - 2014-07-03 21:30:38 --> UTF-8 支持已启用
调试 - 2014-07-03 21:30:38 --> URI 类已初始化
DEBUG - 2014-07-03 21:30:38 --> 路由器类已初始化
调试 - 2014-07-03 21:30:38 --> 不存在 URI。默认控制器集。
DEBUG - 2014-07-03 21:30:38 --> 输出类已初始化
DEBUG - 2014-07-03 21:30:38 --> 安全类已初始化
DEBUG - 2014-07-03 21:30:38 --> 输入类已初始化
DEBUG - 2014-07-03 21:30:38 --> 已清理全球 POST 和 COOKIE 数据
DEBUG - 2014-07-03 21:30:38 --> 语言类已初始化
DEBUG - 2014-07-03 21:30:38 --> 加载器类已初始化
DEBUG - 2014-07-03 21:30:38 --> 已加载配置文件:application/config/site_config.php
DEBUG - 2014-07-03 21:30:38 --> Helper 已加载:language_helper
调试 - 2014-07-03 21:30:38 --> 已加载帮助程序:string_helper
调试 - 2014-07-03 21:30:38 --> 已加载帮助程序:url_helper
调试 - 2014-07-03 21:30:38 --> 已加载帮助程序:text_helper
DEBUG - 2014-07-03 21:30:38 --> Helper 已加载:zahmaci_helper
调试 - 2014-07-03 21:30:38 --> 已加载帮助程序:file_helper
DEBUG - 2014-07-03 21:30:38 --> 数据库驱动类已初始化
DEBUG - 2014-07-03 21:30:38 --> 会话类已初始化
DEBUG - 2014-07-03 21:30:38 --> 会话例程成功运行
DEBUG - 2014-07-03 21:30:38 --> 已初始化分页类
DEBUG - 2014-07-03 21:30:38 --> 模型类已初始化
DEBUG - 2014-07-03 21:30:38 --> 模型类已初始化
DEBUG - 2014-07-03 21:30:38 --> 模型类已初始化
DEBUG - 2014-07-03 21:30:38 --> 模型类已初始化
DEBUG - 2014-07-03 21:30:38 --> 模型类已初始化
DEBUG - 2014-07-03 21:30:38 --> 模型类已初始化
DEBUG - 2014-07-03 21:30:38 --> 模型类已初始化
DEBUG - 2014-07-03 21:30:38 --> 模型类已初始化
DEBUG - 2014-07-03 21:30:38 --> 控制器类已初始化 问候

【问题讨论】:

  • 向我们展示您的路由文件。 /admin 如何映射以及映射到什么?
  • config/routes ,但我认为这不是我要找的东西? ` $route['default_controller'] = "欢迎"; $route['404_override'] = ''; $route['hotel/(:any)'] = "hotel/index/$1"; $route['hotels/(:any)'] = "hotels/index/$1"; `

标签: php codeigniter


【解决方案1】:

在新域中尝试时,您需要更改 database.php 和 config.php base_url。 此外,您需要启用 mod_rewrite 并更改根目录中的 .htaccess 文件。

如果不清楚,请告诉我。

【讨论】:

  • 您的 .htaccess 文件中有什么??
  • 因为 htaccess 文件中的一些小东西现在可以工作了 :) 非常感谢大家
【解决方案2】:

我猜这是VirtualHosthtaccess 的问题。我这么说是因为,据我所知,您的 index.php 正在 istoc 服务器上运行。很明显,此 URL 有效:http://modoko.modokoapp.com/index.php?/admin/login_form,而此 URL 无效:http://modoko.modokoapp.com/admin/login_form。这表明问题显然不是 CodeIgniter 问题,而是 Apache 问题。

  • 您是否为 modoko.modokoapp.com 启用了 RewriteEngine?
  • 您的 RewriteRule 格式是否正确?
  • 您是否正确设置了 RewriteBase?

【讨论】:

  • 我认为重写没问题,因为 RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?/$1 [L ]
  • 当我输入它时,我得到:找不到 URL。
  • @zyrag 正如答案编辑中所述:这不是 CodeIgniter 问题。您确定在该 VirtualHost 上启用了 Rewrite 吗?
  • 我会检查它然后写结果。谢谢
  • 已启用,您认为可能还有其他问题吗?
猜你喜欢
  • 1970-01-01
  • 2014-12-07
  • 2015-04-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-10-28
相关资源
最近更新 更多