为什么我不能访问index.php/blog/,错误为404
本帖最后由 rivercg 于 2010-5-11 03:14 编辑按照教程添加了blog.php,添加了 index() 函数显示hello world,可为什么我不能访问
http://localhost/phpweb/index.php/blog/
我的ci安装在E:\PhpWeb\CodeIgniter_1.7.2目录,使用IIS ISAPI,重定向到http://localhost/phpweb/.
http://localhost/phpweb/index.php是正常的,能够正常显示welcome page。
并且routes.php修改$route['default_controller'] = "blog"的情况下,也能正常显示http://localhost/phpweb/index.php。
但http://localhost/phpweb/index.php/welcome/和http://localhost/phpweb/index.php/blog/也都不行,错误都是404,"The page cannot be found".
去掉url里最后的/ ,试试这样访问.
http://localhost/phpweb/index.php/blog 。。。。显然不行嘛
不是说http://localhost/phpweb/index.php/class/funid/...吗?
有谁知道是什么配置问题吗? 搞了半天最终是因为iis isapi的问题
参考了
http://codeigniter.org.cn/forums ... d=415&highlight=iis
最终的解决方案(后来重定向目录到http://localhost/CodeIgniter/)
(1)config.php设置
$config['base_url'] = "http://localhost/CodeIgniter/";
(2)安装了ISAP_Write lite 2.6,在其httpd.ini中添加
RewriteRule ^/CodeIgniter/index.php/(.*) /CodeIgniter/index.php?/$1
RewriteRule ^/CodeIgniter/(?!index.php)(.*) /CodeIgniter/index.php?/$1
对于(2),也可参考
http://buddylindsey.com/ionics-isapi-rewrite-module-with-code-igniter/
安装开源的IonicIsapiRewriter,然后在其bin目录中添加IIRF.ini,并设置
RewriteEngine On
RewriteRule ^/CodeIgniter/index.php/(.*) /CodeIgniter/index.php?/$1
RewriteRule ^/CodeIgniter/(?!index.php)(.*) /CodeIgniter/index.php?/$1
最终可以访问:
http://localhost/CodeIgniter/index.php
http://localhost/CodeIgniter/index.php/blog/
http://localhost/CodeIgniter/blog/
页:
[1]