在codeigniter中重写url

时间:2012-10-25 10:08:17

标签: .htaccess codeigniter

我的codeigniter网站目前的网址是www.websitename.com/fronend/deals/index/all/all。 (注意:前端是控制器内的文件夹,交易是控制​​器)

我想使用htaccess将其更改为www.websitename.com/deals/。我曾尝试过一些代码,但却无法做到这一点。可以使用htaccess来改变它。

以前,我使用以下htaccess代码从codeigniter网站的网址中删除了index.php。

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]

这很好用。所以我想,我需要为此添加一些重写规则。

你可以解释一下如何做到这一点。谢谢

1 个答案:

答案 0 :(得分:3)

你不需要htaccess

.\application\config\routs.php

添加

$route['deals'] = "fronend/deals/index/all/all";