我是CodeIgniter和路由的新手。codeigniter中的路由問題
我有一個Login
控制器,其index()
加載一個視圖來輸入用戶名/密碼。在該視圖中,表單有action="login/authenticate"
。 Login-> authenticate()確定登錄是否有效。如果它是有效的,redirect('lobby')
,如果不是redirect('login')
routes.php文件:
$route['default_controller'] = "login"
的config.php:
$config['base_url'] = "http://localhost/dts/";
$config['index_page'] = "index.php";
的問題是,當我去http://localhost/dts/
,點擊登錄,我正確(?)重定向到http://localhost/dts/login/authenticate
,但瀏覽器顯示爲Object not found!
。但是,當我去http://localhost/dts/index.php/
(帶斜線),它工作正常(我重定向到http://localhost/dts/index.php/login/authenticate
,和我登錄)
我試圖用的.htaccess刪除「的index.php」:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
它將不再打開連http://localhost/dts/
我很困惑..發生了什麼事?
即使我很困惑。 :) – User 2010-06-02 15:08:40