Forum Discussion
Glenn_Ruffus_10
Nimbostratus
Sep 26, 2006iRule for specific HTTP redirect
I would appreciate help in writing a simple iRule that will look for traffic coming in on some virtual servers that contains a specific URL/URI and will then redirect the browser to go to a slightly different but specific URL/URI. For instance:
if the HTTP request is for "fredflintstone.com/a/b/c/d/default.asp"
then redirect the browser to use "http://www.fredflintstone.com/a/b/c/d/default.asp"
I have something written and it's probably close but I would really appreciate an expert's suggestion to compare it with.
Thanks.
Glenn
1 Reply
- hoolio
Cirrostratus
Hi Glenn,
There are a few different ways to do this. If you only have a small number of host/URI combinations you want to look for, you could use if/else statements. If you have more comparisons to make, you could use a switch or a class comparison.
Here is an if/else example to get started:when HTTP_REQUEST { if { [string tolower [HTTP::host]] equals "fredflintstone.com" and [HTTP::uri] equals "/a/b/c/d/default.asp" } HTTP::redirect "http://www.fredflintstone.com/a/b/c/d/default.asp" } else { pool http_pool } }
If you want further examples, post what you've got so far and what's not working.
Aaron
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
