使用codeigniter出现404问题

yuepengfei 2012-06-01 10:41:44
各位好,初使用codeigniter出现了如下问题:

1、windows xp下运行正常,linux下运行出现404错误。
2、访问主页可以显示(http://ip地址/项目名/或http://ip地址/项目名/index.php/index),但是点登录时(http://ip地址/项目名/index/login)出现404错误,index控制器中是存在public的login方法。
3、linux环境为red hat 企业版5 ,apache为2.0.64,php为5.4.3 apache配置了rewrite也 加了path info

尝试过修改config.php中的uri_request 为各个可能的值(query_string,auto等)现象依旧。

看codeigniter的日志似乎login.php已经发送到浏览器了,但是为什么还是404呢

同样的程序在windows下没有问题,请问大家问题可能出在哪里呢?谢谢!
附codeigniter日志:
DEBUG - 2012-06-01 09:42:54 --> Config Class Initialized
DEBUG - 2012-06-01 09:42:54 --> Hooks Class Initialized
DEBUG - 2012-06-01 09:42:54 --> Utf8 Class Initialized
DEBUG - 2012-06-01 09:42:54 --> UTF-8 Support Enabled
DEBUG - 2012-06-01 09:42:54 --> URI Class Initialized
DEBUG - 2012-06-01 09:42:54 --> Router Class Initialized
DEBUG - 2012-06-01 09:42:54 --> Output Class Initialized
DEBUG - 2012-06-01 09:42:54 --> Security Class Initialized
DEBUG - 2012-06-01 09:42:54 --> Input Class Initialized
DEBUG - 2012-06-01 09:42:54 --> XSS Filtering completed
DEBUG - 2012-06-01 09:42:54 --> Global POST and COOKIE data sanitized
DEBUG - 2012-06-01 09:42:54 --> Language Class Initialized
DEBUG - 2012-06-01 09:42:54 --> Loader Class Initialized
DEBUG - 2012-06-01 09:42:54 --> Controller Class Initialized
DEBUG - 2012-06-01 09:42:54 --> Helper loaded: form_helper
DEBUG - 2012-06-01 09:42:54 --> Form Validation Class Initialized
DEBUG - 2012-06-01 09:42:54 --> Session Class Initialized
DEBUG - 2012-06-01 09:42:54 --> Helper loaded: string_helper
DEBUG - 2012-06-01 09:42:54 --> Encrypt Class Initialized
DEBUG - 2012-06-01 09:42:54 --> Database Driver Class Initialized
DEBUG - 2012-06-01 09:42:54 --> Session routines successfully run
DEBUG - 2012-06-01 09:42:54 --> DX Auth Initialized
DEBUG - 2012-06-01 09:42:54 --> Session class already loaded. Second attempt ignored.
DEBUG - 2012-06-01 09:42:54 --> Config file loaded: application/config/dx_auth.php
DEBUG - 2012-06-01 09:42:54 --> Language file loaded: language/japanese/dx_auth_lang.php
DEBUG - 2012-06-01 09:42:54 --> Model Class Initialized
DEBUG - 2012-06-01 09:42:54 --> Model Class Initialized
DEBUG - 2012-06-01 09:42:54 --> Model Class Initialized
DEBUG - 2012-06-01 09:42:54 --> utilityies class already loaded. Second attempt ignored.
DEBUG - 2012-06-01 09:42:54 --> Helper loaded: url_helper
DEBUG - 2012-06-01 09:42:54 --> Config file loaded: application/config/access_limit.php
ERROR - 2012-06-01 09:42:54 --> Severity: Notice --> Undefined variable: message /usr/local/apache2/htdocs/tab/application/views/login.php 44
DEBUG - 2012-06-01 09:42:54 --> File loaded: application/views/login.php
DEBUG - 2012-06-01 09:42:54 --> Final output sent to browser
DEBUG - 2012-06-01 09:42:54 --> Total execution time: 0.0547
...全文
858 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
「已注销」 2013-05-16
  • 打赏
  • 举报
回复
建议先确认一下application/errors/下的log,我遇到的问题的由于controllers下的文件名含有大写字母,在linux下不识别导致的 ,CI的框架好像主张类名全部小写
xuzuning 2012-06-01
  • 打赏
  • 举报
回复
如果
http://ip地址/项目名/index.php/index/login 可以访问
http://ip地址/项目名/index/login 不可以访问

那就是你的重写规则不对,请检查一下

两者的区别在于,后者需要隐藏 index.php 这个文件名
window 下的应写作
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]

linux 下应该也是一样的,请核实
yuepengfei 2012-06-01
  • 打赏
  • 举报
回复
我将config.php中的index_page设置为index.php之后http://ip地址/项目名/index.php/index/login会自动出现,windows下index_page是没有设置的但是http://ip地址/项目名/index/login 可以访问。
yuepengfei 2012-06-01
  • 打赏
  • 举报
回复
回老大:

http://ip地址/项目名/index.php/index/login 可以访问

http://ip地址/项目名/index.php/login 不可以访问

请问我要如何修改才能使得http://ip地址/项目名/index/login 可以访问呢,谢谢!
xuzuning 2012-06-01
  • 打赏
  • 举报
回复
先尝试一下这样是否可以
http://ip地址/项目名/index.php/index/login
http://ip地址/项目名/index.php/login
该源码是一款比较简单的Simple Down 简单下载系统 v6.0,系统的源码比较简单的,而且也很容易修改,非常适合一些朋友的二次开发使用,Simple Down 简单下载系统,全新安装:1 上传所有文件到安装目录 2 修改配置文件:root/config/config.php 第17行 .... 4 新建数据库导入HBDX.sql还原。 5 站长统计插件:root/view/footer.php 第10行 换成你自己的统计代码 多说社会化评论插件:root/view/view.php 第34-47行 换成你自己的代码。你也可以用其他的插件,例如友言。 6 如果你的服务器使用的是Apache、MySQL、PHP这种网站服务器架构,则不需要其他修改。如果你的网站使用的是Nginx、MySQL、PHP这种网站服务器架构,需要开启Nginx的伪静态功能。例如我的Linux主机使用的环境是LNMP,在添加主机的时候就选择了wordpress的伪静态规则。如果未开启,应该会出现首页正常访问,其他路径404错误。例如:访问http://d.hbdx.cc/view/2219出现404错误。此时你可以访问一下http://d.hbdx.cc/index.php/simple/view/2219,如果这个地址可以访问那说明一定是未开启伪静态导致的。Nginx开启伪静态的方法见Nginx官网:http://wiki.nginx.org/Codeigniter 7 程序默认管理员admin 密码 83641010。 8 添加分类:还有一些程序的设置功能还没有做出来。数据库中只有蓝光一个默认的分类。添加新的分类需要在表HBDX_BASEINFO中添加记录。其中"2"表示序号,"新分类"表示分类名称。当然你也可以手动添加。道理一样。

4,250

社区成员

发帖
与我相关
我的任务
社区描述
国内外优秀PHP框架讨论学习
社区管理员
  • Framework
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧