Forum Discussion

jony23's avatar
jony23
Icon for Nimbostratus rankNimbostratus
Sep 12, 2018

Need some help with a redirect

I need to do the folowing 301 redirects:

 

from to

 

and

 

from to

 

was trying with [HTTP::query [HTTP::uri]] but wasn't capable to achieve that. If anyone can help me, please. thanks in advance

 

1 Reply

  • you can try this:

    when HTTP_REQUEST {
      if {[HTTP::host] equals "www.host.com" && [HTTP::path] equals "/path1/path2.jsp"} {
        HTTP::respond 301 Location /path3/[URI::query [HTTP::uri] query1]/[URI::query [HTTP::uri] query2][expr {[set var1 [URI::query [HTTP::uri] var1]] ne "" ? "/?var1=${var1}" : "" }]
      }
    }