重写的.htaccess通过通过所有查询字符串 [英] .htaccess rewrite pass all query strings through
本文介绍了重写的.htaccess通过通过所有查询字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
目前我使用的:
RewriteRule ^([^/\.]+)/?$ page.php?page=$1 [L]
这是很好的传递通过一个查询字符串时为。
Which is good for when passing one querystring through.
但有没有办法只是从中穿过所有的查询字符串?即一个页面请求可能是:
But is there a way just to pass all querystrings through? i.e. One page request might be:
domain.com/contact?course=23
和另一个可能是:
domain.com/contact?workshop=41
所以,我需要知道的查询字符串的名字是,但只有过一会在同一时间内传递
So I need to know what the query string name is, but only ever one will be passed in at a time
推荐答案
如果我正确地理解你的问题,你可以添加的 [QSA]
(查询字符串追加)标志到重写规则的结束
If I understand your question correctly, you can just add the [QSA]
(query string append) flag to the end of your RewriteRule
RewriteRule ^([^/\.]+)/?$ page.php?page=$1 [L,QSA]
这将处理您的请求,因为你已经完成,并添加任何进一步的查询字符串PARAMS到年底。
This will process your request as you've already done, and add any further querystring params onto the end.
这篇关于重写的.htaccess通过通过所有查询字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文