abdul shabban
abdul shabban

Reputation: 23

how to define route in codeigniter i am trying but it not working

$route['default_controller'] = 'Student';
$route['admin'] = 'index.php/Admin_depart/index';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;

I am fairly new to CodeIgniter and finishing up my first project. However, before I put it up on my hosting site I would like to clean up the URL's using the routes.php file that CodeIgniter provides in the config folder. but it is not working it work correctly when i write same url i the default_controller

Upvotes: 0

Views: 35

Answers (1)

Javier Larroulet
Javier Larroulet

Reputation: 3237

The index.php is causing the issue.

Route destinations must be defined only as a controller/method pair. So in your case the correct route would be:

$route['admin'] = 'Admin_depart/index';

anyone browsing to yoursite.com/admin would be served whatever is in your Admin_depart controller, index method (just as if he/she browsed directly to yoursite.com/admin_depart/index;

Upvotes: 1

Related Questions