Forum Discussion

Mike_Wethington's avatar
Mike_Wethington
Icon for Nimbostratus rankNimbostratus
Aug 20, 2009

Redirect stripping off the uri

I need to redirect all traffic that would come to either http://www.domain.com/something in the uri to http://www.domain.com (i need to do this for http and https traffic). Can somebody let me know how to do this?

 

 

this is what i use to redirect if there is not anything in the URI

 

 

} elseif { ([HTTP::host] eq "www.domain.com") && ([HTTP::uri] eq "/") } {

 

pool mypool

 

 

but what do i do if there is something in the URI?

 

 

Any help is much appreciated.

3 Replies

  • Hi,

    You want to redirect (or send to a pool? - different actions there) when there is anything at all in the URI? You can just reverse your logic then and say:

     
     elseif { ([HTTP::host] eq "www.domain.com") && (![HTTP::uri] eq "/") } {  
     

    (just inserting the ! before the comparison)

    Denny
  • I do actually need to redirect it to http://www.domain.com

     

     

    so would it be hte same as above but HTTP:Redirect www.domain.com? Thanks for your response.
  • Yes, then the whole clause would be:

     
     } elseif { ([HTTP::host] eq "www.domain.com") && (![HTTP::uri] eq "/") } { 
       HTTP::redirect "http://www.domain.com" 
     } 
     

    It seems like that might get into a loop though if the server ever directs the client to some other URI, but without knowing your application logic I can't really speak to that.

    Denny