简体   繁体   English

如何在Codeigniter中重写查询字符串URL的URL

[英]How do I rewrite URL for query string url in codeigniter

I trying to create SEO friendly urls in an existing Code igniter application.I could find a no of query string urls and i need it to convert it SEO friendly. 我试图在现有的代码点火器应用程序中创建SEO友好的url。我找不到查询字符串url,我需要它来将其转换为SEO友好的。

I want to rewrite the following url 我想重写以下网址

for. 对于。 eg : 例如:

http://example.com/en/properties?id_categories=3&sub_categories=65&sub_categories2=5391 http://example.com/zh-CN/properties?id_categories=3&sub_categories=65&sub_categories2=5391

to seo friendly as follows : 对seo友好如下:

http://example.com/en/properties/residential-for-rent http://example.com/en/properties/residential-for-rent

Please guide me to fix this. 请指导我解决此问题。

You need to read this document about URI Routing carefully: http://www.codeigniter.com/userguide2/general/routing.html 您需要仔细阅读有关URI路由的文档: http : //www.codeigniter.com/userguide2/general/routing.html

Something like: 就像是:

$route['properties/(:any_properties_slug)'] = "properties/get";

Then you can put your code into controller Properties::get() to lookup property by any_properties_slug 然后,您可以将代码放入控制器Properties :: get()中,以通过any_properties_slug查找属性

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM