如何重写URL在codelgniter重写、URL、codelgniter

由网友(你以为我刀枪不入)分享简介:您好首先,我告诉大家,在codelgniter框架我是新的,我已经与我的网址有问题的URL看起来像这样http://www.vacationplannersnetwork.com/search/name/france Hello First i tell all of you that in codelgniter...

您好首先,我告诉大家,在codelgniter框架我是新的,我已经与我的网址有问题的URL看起来像这样 http://www.vacationplannersnetwork.com/search/name/france

Hello First i tell all of you that in codelgniter framework i am new and i have a problem related to my url the url looks like this http://www.vacationplannersnetwork.com/search/name/france

但我希望我的URL看起来像这样 http://www.vacationplannersnetwork.com/france

but i want my URL looks like this http://www.vacationplannersnetwork.com/france

我做搜索这个网站的引擎优化,所以我想这种类型的结构,因此,如果有人知道的话请帮我其高度recommended.thanks先进的。

I do search engine optimization of this website so i want this type of structure ,so if anyone knows then please help me its highly recommended.thanks in advanced.

推荐答案

这是可以做到在rerouteing。 在你的 APPPATH。 routes.php文件文件中加入这一行:

It can be done over rerouteing. In your APPPATH . 'routes.php' file add this line:

$route['(:any)'] = 'search/name/$1';

既然你想有第一个URI段相匹配的结果

,您将需要一个前添加其他特定的路线。例如:

Since you want to have first URI segment matching your results, you would need to add other specific routes before that one. For example:

$route['contact-us'] = 'public_controller/contact_method';
$route['aboout-us'] = 'public_controller/aboutus_method';
/*
 * other routes
 * here
 */
$route['(:any)'] = 'search/name/$1';

文档。

此外,如果需要的话不要忘记更改链接锚鉴于文件(静态页面/变量)。

Also, don't forget to change links anchor in view files if needed (for static pages/variables).

阅读全文

相关推荐

最新文章