如何使用mod_rewrite将查询字符串转换为路径URL? [英] How to convert querystring to paths URL using mod_rewrite?
本文介绍了如何使用mod_rewrite将查询字符串转换为路径URL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试将具有查询字符串的URL改写为其SEO友好名称,即考虑
I'm trying to rewrite a URL that has a query string to its SEO friendly name i.e. consider
mysite.com/models?p1=v1
我想将其重写为
mysite.com/models/p1/v1
用户应在地址栏中看到以上地址.有任何建议吗?
The user should see the above address in address bar. Any suggesstions?
推荐答案
.htaccess
应为:
RewriteEngine On
RewriteRule ^models/(.+)/(.+)$ models.php?$1=$2 [NC,L]
这篇关于如何使用mod_rewrite将查询字符串转换为路径URL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文