Url Amicable Codeigniter

Asked

Viewed 166 times

1

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

www.siteexemplo.com.br/parm1/parm2

I set up the file Routes as follows:

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

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

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

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

Has anyone ever needed to do anything like that to help me?

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 to change and make sure it works.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.