routing problem in codeigniter
Posted
by Obay
on Stack Overflow
See other posts from Stack Overflow
or by Obay
Published on 2010-06-02T14:54:52Z
Indexed on
2010/06/02
17:53 UTC
Read the original article
Hit count: 387
I'm new to CodeIgniter and routing.
I have a Login
controller whose index()
loads up a view to enter a username/password. In the view, the form has action="login/authenticate"
. Login->authenticate() determines if the login is valid or not. If it's valid, redirect('lobby')
, if not redirect('login')
routes.php:
$route['default_controller'] = "login"
config.php:
$config['base_url'] = "http://localhost/dts/";
$config['index_page'] = "index.php";
The problem is that when i go to http://localhost/dts/
, click login, I am correctly (?) redirected to http://localhost/dts/login/authenticate
but the browser says Object not found!
. But when I go to http://localhost/dts/index.php/
(with trailing slash), it works correctly (I get redirected to http://localhost/dts/index.php/login/authenticate
, and am logged in)
I tried removing "index.php" by using a .htaccess:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
and it would no longer open even the http://localhost/dts/
I'm confused.. what's going on?
© Stack Overflow or respective owner