I am trying to redirect a url with php key values to a different domain.
The site is being deprecated so I tried a simple redirect by hard coding the URL but could not get that to succeed.
I have also tried using RewriteCond
using QUERY_STRING
and RewriteRule
. I found success using only 1 key value here but when I tried using multiple key values, it does not pick up the second key and causes the redirect to fail.
RewriteCond %{QUERY_STRING} (|&)key1=value1($|&)
RewriteCond %{QUERY_STRING} (|&)key2=value2($|&)
RewriteRule (.*) https://www.example.com/new/path [L,R=301]
Expected result: example1.com/sample.php?key1=value1&key2=value2
--> example2.com/new/path