Given the url: https://{SITE}/tgif/flink?search1=scode=atrre%20and%20year=2023&format=USGARS I want to rewrite it to https://{SITE}/tgif/flink/TERO/2023. Where 2023 is the only variable part of the redirect and format or search1 can come in either order.
My apache rewrite rules for this are:
RewriteCond %{QUERY_STRING} (?:^|&)format=USGARS [NC] RewriteCond %{QUERY_STRING} (?:^|&)search1=scode(?:=|%3D)atrre(?:[\ +]|%20)and(?:[\ +]|%20)year(?:=|%3D)(\d{4}) [NC] RewriteRule ^tgif/flink$ /tgif/flink/TERO/%1 [QSD,R=301,L] The redirect does not work even though the regex validates using other tools, rather it is skipped as if it doesn't exist. I have dozens of other similar rewrites that work fine. The only difference I see in this is that this one has = signs in value for the search1 query. Does someone else see something wrong and/or know how to properly handle this instance? Does apache handle the extra = signs in some special way that I am not aware of?
=by Apache. More likely you have a conflict with your existing rules (or you are seeing a cached response). Please edit your question to include your complete.htaccessfile with this rule in place. (Aside: You should test first with 302 - temporary - redirects to avoid caching issues.)