Search code examples
phpcodeigniterroutes

Writing rules in routes.php for Codeigniter


I need a help for routes.php

I have 2 types of URLs like - https://www.seekmi.com/service/jakarta/digital-marketing and https://www.seekmi.com/en/service/jakarta/digital-marketing

and for those i wrote 2 rules in routes.php with same controller as -

$route['en/service/(:any)/(:any)'] = "findservice/search/$1/$2";
$route['service/(:any)/(:any)'] = "findservice/search/$1/$2";

but only first URL works, not second one. Can any one of you please help me resolve this issue ?


Solution

  • try this

    $route['service/(:any)/(:any)'] = "findservice/search/$1/$2";
    $route['en/service/(:any)/(:any)'] = "findservice/search/$1/$2";