Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/reporting-services/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Url rewriting 关于科哈纳的路线问题_Url Rewriting_Kohana - Fatal编程技术网

Url rewriting 关于科哈纳的路线问题

Url rewriting 关于科哈纳的路线问题,url-rewriting,kohana,Url Rewriting,Kohana,我正在使用kohana 2.3,我在config/routes.php上遇到了问题 我正在将www.abc.com/var1/var2重定向到/profile/show/var1/var2,行为: $config['(.*)/(.*)/'] = '/profile/show/$1/$2/)'; 没问题,但我想把www.abc.com/var1/var2/feedbacks重定向到/profile/feedbacks/var1/var2,但我做不到。我使用这个规则: $config['(.*)/

我正在使用kohana 2.3,我在config/routes.php上遇到了问题

我正在将www.abc.com/var1/var2重定向到/profile/show/var1/var2,行为:

$config['(.*)/(.*)/'] = '/profile/show/$1/$2/)';
没问题,但我想把www.abc.com/var1/var2/feedbacks重定向到/profile/feedbacks/var1/var2,但我做不到。我使用这个规则:

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

但我不工作。始终工作优先规则。

路由的加载和检查顺序与在配置文件中添加的顺序相同。您应该在更接近开始的位置设置更具体的规则,并在“路线末尾”列表中设置默认路线:

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

路由的加载和检查顺序与在配置文件中添加的顺序相同。您应该在更接近开始的位置设置更具体的规则,并在“路线末尾”列表中设置默认路线:

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