jems
jems

Reputation: 61

How to route multiple controllers in codeigniter?

I got error "Unable to determine what should be displayed. A default route has not been specified in the routing file"

I have two controllers 1.signup and 2.login_control !

How to set routes in routes.php file ? my baseurl is http://localhost:1337/PhpProject1/

my code is below in routes.php file

$route['signup/(:any)'] = 'signup';
$route['login_control/(:any)'] = 'login_control';

$route['404_override'] = '';

Upvotes: 0

Views: 4752

Answers (2)

Arvind Jaiswal
Arvind Jaiswal

Reputation: 442

First, specified your default route by your first controller.

Like this-

$route['default_controller'] = "signup";

and then add your another controller.

$route['login-control'] = 'login_control';

Upvotes: 1

Abdulla Nilam
Abdulla Nilam

Reputation: 38584

Do like this

Syntax

$route['how_its_look_like'] = 'controller_name/method';

Example

$route['signup'] = 'login/signup';
$route['login'] = 'login/login';
$route['logout'] = 'login/logout';

$route['404_override'] = '';

Links

Ccodeigniter Routing Examples

Upvotes: 0

Related Questions