I would like to remove
fb_xd_fragment
from the query string and pass the rest of the request off t开发者_运维百科o the application level. This is for an improved cache hit rate so doing this modification at the application level is not useful nor possible (trust me). Example of how to modify the query string using apache or nginx would be nice.
Example input values
example.com/abcd?page=2&fb_xd_fragment
example.com/abcd?fb_xd_fragment
example.com/abcd?fb_xd_fragment&page=4
example.com/abcd?fb_xd_fragment=xyz&page=6
example.com/abcd?page=8&fb_xd_fragement=xyz
With mod_rewrite, a RewriteRule can't be used to match a query string, but you can apply a RewriteCond to spot a target query string. Crucially, you can backreference matches in the RewriteCond in the rewrite rule, so try something along these lines:
# we can refer to this----+-----------------and this--+
# match as %1 in the | match as %2 |
# RewriteRule | |
v v
RewriteCond %{QUERY_STRING} ^(.*)fb_xd_fragment=?[a-z]*&?(.*)$
RewriteRule /abcd /abcd?%1%2
The %x in the RewriteRule is a backreference to the last matched RewriteCond. You might need to play around with this to get exactly the effect you want, but you should see the basic principle. Good luck :)
This parameter is actually symptomatic of Facebook Connect or a Like button doing bad things. You can avoid it altogether by configuring the javascript correctly.
http://threebrothers.org/brendan/blog/facebook-connect-ie-fb_xd_fragment-iframe/
精彩评论