url重写查询字符串

时间:2011-12-12 06:28:07

标签: url mod-rewrite query-string

我想修改重写网址,我只是想知道如何重写我的查询字符串类型的网址

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

进入

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

我有这个htaccess文件请告诉我它是否正确

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

1 个答案:

答案 0 :(得分:1)

在DOCUMENT_ROOT的.htaccess文件中使用此代码:

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