Forum Discussion
Mike_Wethington
Nimbostratus
Aug 20, 2009Redirect 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
- dennypayne
Employee
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 - Mike_Wethington
Nimbostratus
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. - dennypayne
Employee
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
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects
