Forum Moderators: phranque
There are URLs hanging around like:
http://www.example.com/sim/jsp/commerce_order_history.do?mode=orderHistory
&BV_SessionID=@@@@1335499620.1157821238@@@@&BV_EngineID=ccddaddikkleefdcflgcefkdfkjdffl.0&channelId=-8815
&rootChannelName=%2FCommerce+Navigation%2FCustomer+Service&channelName=Customer+Service&programId=1610630353
I want to strip out the BV_SessionID and BV_EngineID variables and 301 redirect to a 'session-free' URL like:
http://www.example.com/sim/jsp/commerce_order_history.do?mode=orderHistory&channelId=-8815
&rootChannelName=%2FCommerce+Navigation%2FCustomer+Service&channelName=Customer+Service&programId=1610630353
Note: This is just a single example, throughout the site there are many different filenames with various querystrings, the only thing they ALL have in common is the fact that they contain the BV_SessionID and BV_EngineID variables. So I'm trying to write a rule that captures any URL containing the session/engine variables in the querystring.
I have the following rule that I've been tinkering with:
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{QUERY_STRING} ^(.*)&BV_SessionID=(.*)&BV_EngineID=(.*)\.[0-9]*(.*)
RewriteRule (.*)? http://www.example.com/test.htm? [R=301,L]
I know that I've got the QUERY_STRING condition matching because the first URL mentioned above 301 redirects to /test.htm.
But I'm not sure where to go from here. I'm not sure how to write the RewriteRule so that is pulls the different pieces of the regular expression apart and then rewrites the URL to just include what (I think) should be "$1" and "$4" from the expression.
Any help? Am I even making sense? %-)
[edited by: jdMorgan at 2:23 pm (utc) on Sep. 12, 2006]
[edit reason] Fix side-scroll, examplified [/edit]