比如:
http://www.xxx.com/x/index.html
http://www.xxx.com/x/index.html?b1=y&b2=z&....
http://www.xxx.com/x/question.html
http://www.xxx.com/x/question.html?b1=y&b2=z&....
怎么写rewrite规则,把上面的转换为下面的链接:(就是把a1这个参数的值改为问号后面参数传入)
http://www.xxx.com/index.php?a1=x
http://www.xxx.com/index.php?a1=x&b1=y&c1=z&....
http://www.xxx.com/question.php?a1=x
http://www.xxx.com/question.php?a1=x&b1=y&c1=z&....
比如:
http://www.xxx.com/x/index.html
http://www.xxx.com/x/index.html?b1=y&b2=z&....
http://www.xxx.com/x/question.html
http://www.xxx.com/x/question.html?b1=y&b2=z&....
怎么写rewrite规则,把上面的转换为下面的链接:(就是把a1这个参数的值改为问号后面参数传入)
http://www.xxx.com/index.php?a1=x
http://www.xxx.com/index.php?a1=x&b1=y&c1=z&....
http://www.xxx.com/question.php?a1=x
http://www.xxx.com/question.php?a1=x&b1=y&c1=z&....
我写一个index.html的规则,question.html的题主照着自己写一下吧。RewriteRule ^/x/index.html$ /index.php?a1=x [NC,L]
RewriteRule ^/x/index.html\?([^\/])+$ /index.php?a1=x&$1 [NC,L]
用正则匹配的反向引用,用这种方法其实a1,b1,c1三个参数都可以写到RewriteRule里的,前面伪静态后边是查询字符串是不是有点怪怪的。