url rewriting a query string

岁酱吖の 提交于 2019-12-25 03:27:56

问题


I want to mod-rewrite url and i am just wondering how do i rewrite my url of querystring type

http://localhost/folder/index.php?param1=value1&param2=value2&param3=value3 

into

http://localhost/folder/value1/value2/value3

I have this htaccess file please tell me if it correct

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^index/(w+)/(w+)/(w+)$ /index.php?param1=$1&param2=$2&param3=$3 [nc]

回答1:


Use this code in your DOCUMENT_ROOT's .htaccess file:

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{QUERY_STRING} !param1= [NC]
RewriteRule ^([^/]*)/([^/]*)/([^/]*)/([^/]*)$ $1/index.php?param1=$2&param2=$3&param3=$4 [QSA,L]


来源:https://stackoverflow.com/questions/8470670/url-rewriting-a-query-string

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