URL重写查询字符串(url rewriting a query string)

2019-10-30 00:37发布

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

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]

Answer 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]


文章来源: url rewriting a query string