owner888 发表于 2009-3-9 21:55:07

在linux下配置的虚拟目录运行CI有404错误

这个是我的虚拟目录配置:
Alias /news "/var/www/application/news/"
<Directory "/var/www/application/news">
    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
   <IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 seconds"
ExpiresByType text/html "access plus 1 seconds"
ExpiresByType image/gif "access plus 1 week"
ExpiresByType image/jpeg "access plus 1 week"
ExpiresByType image/png "access plus 1 week"
ExpiresByType text/css "access plus 1 week"
ExpiresByType text/javascript "access plus 1 week"
ExpiresByType application/x-javascript "access plus 1 week"
ExpiresByType text/xml "access plus 1 seconds"
</IfModule>
</Directory>
以下是我的ci配置
$config['base_url']   = "http://172.16.7.2/news";
以下是我的一个测试控制器Test:
<?php
class Testextends Controller{
    function __construct()
    {
      parent::Controller();
    }
    function index()
    {
      echo "OK"
    }
}
以下是浏览器输入地址:
http://172.16.7.2/news/index.php/Test
运行时发生404错误,大家帮帮忙,看看是什么问题。。。

lzx870417 发表于 2009-3-9 21:58:25

1# owner888

顶你下,ISA防火墙阻止访问你的链接了

owner888 发表于 2009-3-9 22:00:38

绝对没有,我还有其他很多网站在运行呢,如果防火墙阻止了,其他的还能运行吗?

Hex 发表于 2009-3-10 00:08:29

$config['base_url']   = "http://172.16.7.2/news";
一定要带斜杠:
$config['base_url']   = "http://172.16.7.2/news/";

不过这不一定是 404 错误所在,但是必须以斜杠结尾。
还有注意大小写问题 Test,错,应该是 test。

很多都要严格遵守 CI 手册的约定,对你是有好处的。

ps: 楼主的问题可以肯定是服务器环境问题,看看 phpinfo,可以发一个截图上来,呵呵。

owner888 发表于 2009-3-10 17:06:37

4# Hex
不是的,不用加/,在我的FC下运行好好的,所以应该不是这个问题,而且应该大写,因为是类名,你的类名用小写来写?所以也不是大小写问题

浪迹天涯 发表于 2009-3-11 17:31:17

Hex说的并不是你发生404错误原因,你在访问的时候应该是小写的test

owner888 发表于 2009-3-12 18:34:50

本帖最后由 owner888 于 2009-3-12 18:36 编辑

6# 浪迹天涯 小写是对的,谢谢你的回答,感激不尽啊
页: [1]
查看完整版本: 在linux下配置的虚拟目录运行CI有404错误