Forum Discussion

dionlbc_22838's avatar
Icon for Nimbostratus rankNimbostratus
Jan 18, 2012

Host and URI rewrite

Hi All,



I'm stepping in to help with an F5 configuration while our person who is primarily responsible is out on maternity leave. I'm looking to do what seems to be a simple redirect of the hostname and URI.




I'm trying to redirect the following -




redirects to




I would like to keep any paths beyond /pwa in the URL when the redirection is made if possible.




Thanks for any and all help! :)


4 Replies

  • Hi,

    If you want the client to see the hostname, you can send them a 302 redirect with an iRule like this:

    when HTTP_REQUEST {
    if {[string tolower [HTTP::host]] eq ""\
    and [string tolower [HTTP::uri]] starts_with "/products/pwa"}{
    HTTP::redirect "[HTTP::uri]"

    If you want to hide the host name from the client you can use the ProxyPass iRule:

  • Hi there! I'm new to iRules and was wondering how I could do a similar thing but have it redirect all requests but keep the trailing path. ie:


  redirects to:





    where Bananas could be any path at all.
  • Hi Ruddiger,

    Just a minor modification to the solution that Hoolio posted would do what you are needing:

    when HTTP_REQUEST {
    if {[string tolower [HTTP::host]] eq "" } {
            HTTP::redirect "[HTTP::uri]"