1

I am getting problem on codeigniter routing when routing url starts with variable like following -

$route['(:any)/(:any)']  = "home/index/0/N/DealsAmount/ASC/$1/$2";

i can to able to configure other routing url when i am passing values through url. Example: Following things work perfectly

$route['About-Us/Team'] = "aboutus/team";
$route['About-us/Jobs'] = "aboutus/jobs";
$route['About-Us/FAQ'] = "aboutus/faq";

But i use this url using varible like following --

$route['About-Us/Team/(:any)'] = "aboutus/team/$1";
$route['About-Us/Team/(:any)/(:any)'] = "aboutus/team/$1/$2";
$route['About-us/Jobs/(:any)'] = "aboutus/jobs/$1";
$route['About-Us/FAQ/(:num)'] = "aboutus/faq/$1";

then it redirects to the home page that means this routing is not working here $route['(:any)/(:any)'] is working how can i able to rout these types of url can you please advise me.

1 Answer 1

1

You have to put the routes with :any at the bottom. If you put it at the top other routes never get caught. This should be OK:

$route['About-Us/Team/(:any)/(:any)'] = "aboutus/team/$1/$2";
$route['About-Us/Team/(:any)'] = "aboutus/team/$1";
$route['About-us/Jobs/(:any)'] = "aboutus/jobs/$1";
$route['About-Us/FAQ/(:num)'] = "aboutus/faq/$1";
$route['(:any)/(:any)']  = "home/index/0/N/DealsAmount/ASC/$1/$2";
Sign up to request clarification or add additional context in comments.

1 Comment

You're welcome. You can click the "V" next to my answer to mark your question as solved.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.