Forum Discussion

lisiecki_54902's avatar
lisiecki_54902
Icon for Nimbostratus rankNimbostratus
Sep 08, 2017

redirect all uri to a subdirectory on a different site

I want to redirect all uri to a subdirectory on a different site

when HTTP_REQUEST {
  if {[string tolower[HTTP::uri]] starts_with "/")} {
    HTTP::redirect "http://www.example.com/some_directory/[HTTP::uri]"
  }
}

1 Reply

  • Hi,

    All URI start with /. The condition will match all requests.

    Don't convert URI to lowercase if there is no alphabetical character in the compared string.

    You can try this

    when HTTP_REQUEST {
        HTTP::redirect "http://www.example.com/some_directory/[HTTP::uri]"
    }