我使用笨2.建立了一個網站http://example.com默認的控制器是
如何將所有內容都路由到codeigniter中的默認控制器?
$route['default_controller'] = "domain";
如果我嘗試訪問pageX屬性,鏈接應該http://example.com/en/domain/view/pageX
。
我想允許網站訪問者通過鍵入
http://example.com/pageX
訪問此頁我試圖
$route['(:any)'] = "view/$1"; ==> it gives 404 Page Not Found
$route['(:any)'] = "domain/view/$1"; ==> it redirects to homepage with link shown as http://example.com/en/pageX
$route['(:any)'] = "en/domain/view/$1"; ==> it gives 404 Page Not Found
但其中非爲我工作。
編輯
加入這樣的:
$route['(:any)'] = 'domain/view/$1';
$route['en/blog'] = 'domain/view/blog';
example.com/blog
將正常工作 ,但我需要的是更廣泛的覆蓋,除了管理所有頁面,這樣的事情:
$route['(:any)'] = 'domain/view/$1';
$route['^(?!admin).*'] = 'domain/view/$o';
//The above routes will show the home page only for whatever i try!!
什麼是我必須添加到routes.php
的路線?
感謝您的幫助管理我的問題,,,但這並沒有工作!我正嘗試使用http://example.com/PageX路由到http://example.com/en/domain/view/PageX ....所以您提供的正則表達式與我的輸入不匹配。 .. 我對嗎? – Lina 2012-02-19 21:31:33
我誤解了。更新。 – landons 2012-02-19 22:35:58
沒有工作,,,仍然給「404頁面找不到」;( – Lina 2012-02-20 08:31:08