tonypartridge
tonypartridge

Reputation: 292

htaccess change a query string name & value

I have been trying to fathom this out for a little while and can't seem to come to a conclusion that always works.

I just need to replace a query string name see:

index.php?option=com_hikashop&ctrl=checkout&task=notify%C2%ACif_payment=bf_rbsbusinessgateway&componentStyle=common

we get the above which is the part I need to manipulate there are more query strings attached about 5-10 dependant.

I just need to change the section:

task=notify%C2%ACif_payment

to:

&task=notify&notif_payment

Can any mod rewrite experts provide a solution?

Upvotes: 1

Views: 192

Answers (1)

anubhava
anubhava

Reputation: 786359

You can use this rule as your first rule in site root .htaccess:

RewriteCond %{THE_REQUEST} \?(.*&)?(task=notify)\%C2\%AC(if_payment)&?(\S*)\sHTTP [NC]
RewriteRule ^index\.php$ %{REQUEST_URI}?%1%2&not%3%4 [R=301,NE,L]

Make sure to clear your browser cache before testing this change.

Upvotes: 1

Related Questions