Url Amigavel Codeigniter

1

In Codeigniter there is a configuration file called router.php where we set up friendly urls. In the url of the site I'm making I need to leave 2 dynamic parameters like this:

www.siteexemplo.com.br/parm1/parm2

I configured the routes file as follows:

router['(:any)'] = "paginas/buscap1/(:any)";

router['(:any)/(:any)'] = "paginas/buscap2/(:any)/(:any)";

This means that when I have parameter 1 for example in the url the site will redirect to the controler paginas in the buscap1() method and in it I filter the (:any) parameter. >

The problem is that when url has the second parameter, routing does not work and the system only redirects to the same method when it only has one parameter.

Has anyone ever had to do something similar that can give me a help?

    
asked by anonymous 04.05.2018 / 15:34

1 answer

1

Hello

In fact the route configuration is done as follows:

$route['minhaRota/Testando/(:any)/(:any)'] = 'paginas/buscap1/$1/$2';
$route['minhaRota/Testando2/(:any)/(:num)'] = 'paginas/buscap2/$1/$2';

Try changing and make sure it works.

    
19.06.2018 / 21:53