codeigniter路由无法在ubuntu服务器上运行

时间:2013-12-29 08:13:33

标签: php codeigniter codeigniter-url

我正在使用我安装的ubuntu服务器。我使用codeigniter框架工作制作了一个php web应用程序。大部分工作都很顺利。但问题是我不能像这样使用ulr

<a href="<?php echo base_url().'new_user'; ?>" >New User</a>

它会将我重定向到错误页面

The requested URL /sdbl/new_user was not found on this server.

我的route.php文件看起来像这样。

$route['new_user'] = "new_user/controller_new_user";

但是当我在href =“”中输入完整的网址时

<a href="index.php/new_user/controller_new_user" >New User</a>

这很好用。

我尝试过像editnig htacces文件那么多的东西。没有什么对我有用。

1 个答案:

答案 0 :(得分:1)

根据CodeIgniter documentation,您应该使用.htaccess文件从URL中删除“index.php”,这是一个示例文件:

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]