views:

45

answers:

1

I'am using kohana 2.3 and i have a trouble with config/routes.php.

I am redirecting www.abc.com/var1/var2 to /profile/show/var1/var2 with this line:

$config['(.*)/(.*)/'] = '/profile/show/$1/$2/)';

It's okey but also i want to redirect www.abc.com/var1/var2/feedbacks to /profile/feedbacks/var1/var2 but i can't done that. I am using this rule:

$config['(.*)/(.*)/feedbacks'] = '/profile/feedbacks/$1/$2/)';

But i doesn't work. Always work first rule.

+3  A: 

Routes are loaded and checked in the same order as they were added in config files. You should set more specific rules closer to beginning, and default route - in the end of route list:

// config/routes.php
$config['(.*)/(.*)/feedbacks'] = '/profile/feedbacks/$1/$2/)';
$config['(.*)/(.*)/'] = '/profile/show/$1/$2/)';
$config['_default'] = 'welcome';
biakaveron