我是CodeIgniter的新手,我的路由配置有一些問題。CodeIgniter顯示頁面沒有css而不是404
一切工作正常,如果我訪問一個頁面,因爲它應該是
http://localhost/index.php/class/controller
但是,如果我加入一些隨機參數
http://localhost/index.php/class/controller/randomStuff
它顯示的頁面沒有CSS或JS,但我想顯示一個404錯誤頁面。
這是我route.php文件在您的幫助
$route['stats'] = 'main/account';
$route['/'] = 'index.php';
$route['/(:any)'] = 'main/disperr'; //Tried this to solve the problem but doesn't work (disperr simply returns show_404())
$route['default_controller'] = 'main';
$route['all'] = 'main';
$route['404_override'] = 'errors/page_missing';
$route['translate_uri_dashes'] = FALSE;
感謝。
編輯:謝謝你的回答! 正確路由頁面後,我stil有缺少的CSS問題。 當我使用樹枝時,我將base_url()作爲參數發送給我的視圖,並將其添加到我的CSS和JS的路徑中。 現在有效。
謝謝,我編輯了這個問題。 –