apache - mod-rewrite to remove tracking code from the end of urls -
how write mod-rewrite remove old tracking code after image urls. send requests
www.myurl.com/blah/image.jpg%12345 to
www.myurl.com/blah/image.jpg the %12345 tracking code same.
the %12345 tracking code same.
at start of string %12 urlencoded unprintable character, mod_rewrite treats _. have inspect request_uri _345 , strip out accordingly.
%3f345 used in url.
if tracking code %3f345, %3f urlencoded ? , should detected query string. however, mod_rewrite doesn't catch seems, used 2 checks case - 1 ? , 1 %3f. work if ? encoded or not:
rewriteengine on rewritecond %{query_string} ^345 [or] rewritecond %{the_request} \%3f345 [nc] rewriterule ^(.*)$ %{request_uri}? [r=301,l] inputs:
http://www.myurl.com/blah/image.jpg?345
http://www.myurl.com/blah/image.jpg%3f345
http://www.myurl.com/blah/image.jpg%3f345¶m=value
rewrite:
note: cannot experiment here because %{the_request} not supported. tested on 1 of live servers verify works.
Comments
Post a Comment