Forum Discussion

Dennis_Jalbert's avatar
Icon for Nimbostratus rankNimbostratus
Sep 24, 2011

Complex Redirect

I’m trying to create a redirect which changes the FQDN, keeps part of the URL static, and preserves the remaining part of the URI. That static part is going to be different on each side of the redirect though. Here is an example:* should redirect to* where * could be anything that needs to be copied over. It seems like I need to assign the wildcard part to a variable and then just use that in the redirect statement, but I’m not sure how to do that. I haven't done anything this complex before and I wasn't able to find anything like this by searching for forums. Thanks in advance!

4 Replies

  • Hi Dennis,


    It's a bid hard to suggest without diving into your example. However the first step I think is outline some commands that might be helpful



    For example URI:: command would help you parse the path or query or port




    I hope this is a good start





  • Patrick_Chang_7's avatar
    Historic F5 Account
    The split command will allow you to separate the URI into sections (based upon the separator - "/" seems the most logical one to use here).
  • Hamish's avatar
    Icon for Cirrocumulus rankCirrocumulus
    Coming from a perl perspective, I'd probably use a regex myself... But timings may force another approach. Long uri strings with many /'s in them may make using split unweildy.



    Testing would show the best approach from a myriad of possibilities.



  • Hey guys,



    Thanks for the help! I was able to do what I needed by using the HTTP::path and the string map command to change the static part of the URI. Then I used the HTTP::redirect command to change the hostname.



    Sorry for not posting sooner, but the forums don't work when I'm on the company network and I kept forgetting to update this when I get home.