用户
 找回密码
 入住 CI 中国社区
搜索
查看: 3749|回复: 4
收起左侧

[已解决] 新手小问:CI访问错误

[复制链接]
发表于 2010-1-15 21:21:15 | 显示全部楼层 |阅读模式
在看文档的时候,照他的例子在application/controllers/下面新建了一个blog.php的文件,而且也键入了代码,但是用
http://localhost/CodeIgniter/index.php/blog访问的时候,却出现:

Object not found!
    The requested URL was not found on this server.      If you entered the URL manually please check your    spelling and try again.  
If you think this is a server error, please contactthe webmaster.Error 404  localhost
    2009å¹´12月15æ—¥ 星期二 21æ—¶14分58秒
  Apache/2.2.14 (Unix) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l PHP/5.3.1 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1


这个是什么原因呢?(P.S.路径中的CodeIgniter是个文件夹,就是官网载的那个东西)
是不是访问方式错误了?
 楼主| 发表于 2010-1-15 21:34:01 | 显示全部楼层
恩,照别人的提示,自己搜索到了一个帖子,结果发现路径错误了,然后改成:
http://example.com/CodeIgniter/index.php
这样子访问以后去出现以下提示,没有成功……
Not Found

The requested URL /CodeIgniter/index.php was not found on this server.
Apache/2.2.3 (CentOS) Server at example.com Port 80
发表于 2010-1-15 22:20:54 | 显示全部楼层
楼主的 APACHE 不支持 PATH_INFO 吧?这个需要看配置的,是服务器环境问题。
可以贴 php_info() 结果看一下。
 楼主| 发表于 2010-1-17 00:46:21 | 显示全部楼层
回复 3# Hex

现在找到原因了,本来装的xampp下面htdocs在很深的地方,结果我想改到E:/www ,然后按照网上的提示修改httpd.conf(好像是这个文件,忘记了),然后找到两个地方是htdocs的路径,全部改成E:/www,结果修改完成以后,xampp读取的还是htdocs的东西,而不是www里面的东西,所以我放在www里面的CI自然不能访问到了~

现在我把CI放在htdocs 可以正常访问了,想随便问一下,怎么改这个路径呢?
发表于 2010-1-23 21:02:30 | 显示全部楼层
其实保留 XAMPP 默认的ROOT目录有好处的,楼主最好是配置apache的虚拟目录
在\xampp\apache\conf\extra\httpd-vhosts.conf 里配置

必须记住第一个虚拟主机一定要指向 你的主目录 也就是 htdocs 目录

我给看一下我的配置内容,便于你参考


  1. <VirtualHost *:80>
  2.         ServerAdmin webmaster@localhost
  3.         ServerName localhost
  4.         DocumentRoot D:/web/xampp/htdocs/

  5.         <Directory "D:/web/xampp/htdocs/">
  6.                 Options Indexes FollowSymLinks MultiViews
  7.                 AllowOverride None
  8.                 Order allow,deny
  9.                 allow from all
  10.         </Directory>
  11. </VirtualHost>       

  12. #这里的是你要配置的虚拟主机


  13. <VirtualHost *:80>
  14.         ServerAdmin webmaster@localhost
  15.         ServerName wp.com #这里是你的虚拟主机的名称,也是可访问的域名
  16.         DocumentRoot D:/web/wordpress/rootwww/  #这里是你的网站的物理路径


  17.         <Directory "D:/web/wordpress/rootwww/"> #这里是虚拟主机的一些权限的设置
  18.                 Options Indexes FollowSymLinks MultiViews
  19.                 AllowOverride None
  20.                 Order allow,deny
  21.                 allow from all
  22.         </Directory>
  23.         # 这里是日志记录,可以不写,直接删掉得了
  24.         ErrorLog D:/web/wordpress/log/error.log
  25.         LogLevel warn
  26.         CustomLog D:/web/wordpress/log/access.log combined
  27. </VirtualHost>

复制代码

本版积分规则