url重写查询字符串 [英] url rewriting a query string

查看:83
本文介绍了url重写查询字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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 

进入

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

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

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]

推荐答案

在您的DOCUMENT_ROOT的.htaccess文件中使用以下代码:

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]

这篇关于url重写查询字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆