【发布时间】:2012-06-04 15:32:18
【问题描述】:
我已经查看了 codeigniter 用户指南,但我没有幸运地解决了我的问题。
我在本地主机上创建了一个网页。
当我去http://localhost/webpage/ 时,没关系。它将转到默认控制器。
我的默认控制器是Homepage,并且有名为index、guarantee和about的方法
当我转到我的 routes.php 时,我添加了这个:
$route['guarantee'] = "homepage/guarantee";
$route['about_us'] = "homepage/about";
然后尝试访问它http://localhost/webpage/guarantee 和http://localhost/webpage/about_us 它显示错误404
但是当我这样做时$route['default_controller'] = "homepage/guarantee";会显示保证页面。
谁能帮我解决这个问题? 谢谢。
【问题讨论】:
-
您在此文件夹中有
.htaccess文件吗? -
在应用程序文件夹中,有一个
.htaccess。我没有碰它。这是我正在使用的 CodeIgniter 的新副本。 -
没关系,我只是问你是否在根目录中添加了一个。你试过
http://localhost/webpage/index.php/guarantee吗? -
是的,它有效。谢谢,但是如何删除
index.php?
标签: codeigniter codeigniter-routing