How to convert querystring to paths URL using mod_rewrite?

半城伤御伤魂 提交于 2019-12-02 08:50:45

问题


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

I'd like to rewrite it to

mysite.com/models/p1/v1

The user should see the above address in address bar. Any suggesstions?


回答1:


The .htaccess should be:

RewriteEngine On
RewriteRule ^models/(.+)/(.+)$ models.php?$1=$2 [NC,L]


来源:https://stackoverflow.com/questions/13474950/how-to-convert-querystring-to-paths-url-using-mod-rewrite

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!