2013-09-23 53 views
0

在我的codeigniter fronend模塊文件$ route變量如下 $ route ['node /:any /'] = array('action'=>'node');Codeigniter路由要刪除節點

它的工作方式與 類似,如果我們將www.example.com/node/aboutus/放在URL中,它會給出有關頁面。 如果我們將www.example.com/node/privacy-policy/設置爲隱私政策頁面。

現在我想將www.example.com/aboutus/放入URL中我想要關於頁面。 現在我想將www.example.com/privacy-policy/放入URL中我想要隱私策略頁面。

基本上我想從URL中刪除節點。 在這裏我的控制器是frontendController,action是節點。 在節點操作中,我在數據庫中提取我的頁面存儲。我有很多頁面存儲在數據庫中。

所以我在fronend模塊文件或路由文件編寫,從網址中刪除節點

回答

0

寫這個代碼在routes.php文件文件(在config文件夾存在):

$route['route_you_want_to_show'] = "current_route"; 

即你的情況

$route['www.example.com/aboutus/'] = "www.example.com/node/aboutus/"; 

現在改變您的網站的鏈接從「www.example.com/node/aboutus/」到'www.example.com/aboutus/'及其隨時可以工作。

但是,在codeigniter路由中很好地介紹了從代碼重定向到控制器及其方法。

+0

這是行不通的,我已經嘗試過 – user822421

+0

你會錯過一些東西!!!嘗試$ route ['aboutus'] =「node/aboutus」; – Dash

+0

我已經做到了,因爲你告訴過但不工作 – user822421