问题
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¶m2=value2¶m3=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¶m2=$2¶m3=$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¶m2=$3¶m3=$4 [QSA,L]
来源:https://stackoverflow.com/questions/8470670/url-rewriting-a-query-string