Ahmed iqbal
Ahmed iqbal

Reputation: 597

How to set proper route config in codeigniter framework

we're using codeigniter framework to build application, but we're facing problem to configure '$route' to send correct request.

we just need to setup these route properly.

How i access category:

Category: http://localhost/codeigniter/category/'category-name'/

$route['category/(:any)'] = 'category/index/$1';

Category Post List By Alphabet:

Category Page by List: http://localhost/codeigniter/category/'category-name'/list/'A'/

$route['category/(:any)/lists/(:any)/'] = 'category/lists/$1';

How i access pages:

Page: http://localhost/codeigniter/page/'category-name'/'page-name'/

$route['page/(:any)'] = 'page/index/$1/$2';

we're using rotue something like that, maybe we have problem in it, please check these and let me know how to fix that.

In our codeingiter installation we are using 'codeigniter' dir, 'category' AND 'page' are controllers. in single quotes we are sending values.

Upvotes: 1

Views: 156

Answers (1)

GautamD31
GautamD31

Reputation: 28753

Try like

$route['page/(:any)/(:any)'] = 'page/index/$1/$2';

And

$route['category/(:any)/lists/(:any)/'] = 'category/lists/$1/$2';// But Iam not sure
$route['category/(:any)'] = 'category/index/$1';

Upvotes: 3

Related Questions