0

I'm trying to replace a string in my url from ?ref= to ?tracking=.

My url looks something like this:

http://mywebsite.com/store/index.php?route=product/product&path=18_40&product_id=214232?ref=12345

and I want the link to read:

https://vaulteksafe.com/store/index.php?route=product/product&path=18_20&product_id=214282?tracking=12345

Keep in mind that the url changes per page. So the only thing I want changed is ?ref.

I'm familiar with the basics of .httaccess so I'm not sure if what I'm trying to accomplish is even possible. I have tried other code I have found here on stack overflow such as RewriteCond %{QUERY_STRING}, but none of it worked.

Any help would be greatly appreciated, or feedback to whether or not what I am trying to do is possible. Thanks!

JCBiggar
  • 2,477
  • 3
  • 20
  • 33

1 Answers1

0

Try with below,

RewriteEngine On
RewriteCond %{REQUEST_URI} ^/store/index.php$
RewriteCond %{QUERY_STRING} ^route=(.*)&path=(.*)&product_id=(.*)?ref=(.*)$
RewriteRule ^ index.php?route=%1&path=%2&product_id=%3?tracking=%4
Abhishek Gurjar
  • 7,426
  • 10
  • 37
  • 45