I've been looking at a few different questions on here that deal with this issue, but none have completely worked the way I'm needing it to.
Take this URL for example:
http://example.com/not-right-contact?portal=9648&...
An email was sent out with this portal ID, but it was incorrect. So, now we need to replace it and redirect the URL properly. Behind the portal query string, there are a number of fields that will prepopulate the form on this page. We need to keep those intact.
Here is what I've cobbled together from a number of sources:
RewriteCond %{QUERY_STRING} (^|&)?portal=9648
RewriteRule ^(.*)$ /not-right-contact?portal=9654%1%2 [L,NE]
This is not doing anything. At one point, I had the URL rewriting to having portal=9654 at the end, but it didn't append any of the additional variables. Help is much appreciated.
UPDATE
Using Manipulating the Query String as reference, I've changed my rewrite to the following:
RewriteCond %{QUERY_STRING} ^(.*)portal=9648(.*)$
RewriteRule (.*) /not-right-contact?%1portal=9654%2 [L]
The rewrite is putting the appended query string data into the form, but the value of the portal query string is still not changing. Whenever I change the first value of the rule to anything but (.*) or .?, I get an HTTP 500 error.