Hello,
I been working on an aflex to do redirection of a web site.
Here’s what I’ trying to achieve:
Src host: mySRCsite.com
Src path: /services/?app=test&annee=2022
Dst host: myDSTsite.com
Dst path: /test/app1/USER=toi&LANGUE=FM&AN_ATTRB=2022
Redirection works, problem is that is hard coded at this time. What I want is check “annee” parameter on src path, save it on a variable and use this variable to overwrite AN_ATTRB value… that way I dont have to remember every year, that I need to change the aflex to correspond the right dates.
This is the aflex I wrote, but it doesn’t work
if {([string tolower [HTTP::host]] starts_with “mySRCsite.com”) and ([HTTP::uri] contains “/services/?app=test&annee=”)} {
set uri [HTTP::uri]
set path “”
regexp -nocase {(/services/?app=test&annee=)(.*)} $uri match path
HTTP::uri /test/app1/USER=toi&LANGUE=FM&AN_ATTRB=$path
HTTP::redirect https://myDSTsite.com[HTTP::uri]
}
Can anyone help me about this?
Thanks in advance!