Forum Discussion
Puneet_73909
Nimbostratus
May 11, 2009Redirection iRule
Hi,
I need help in writing an iRule. I want to read domain name and then redirect it to specific URL.
For example if HHTP::request is for www.domain.com then it will redirect it to www....
The_Bhattman
Nimbostratus
May 11, 2009I think it will work. But I am not sure if this is the most efficient way to have request run through
Here is how I look at this code. Let us know if that is what you were intending:
The first conditional statement will check the host name www.example.com and if it matches then redirect and exit out of the event. If it does not then go to the second elseif statement. If the domain starts with www1 then redirect and exit out of the event. This is equivalent to www1* wildcard so pretty much any domain starting with www1 will match this statement. If that doesn't match then it will go to the 3rd elseif. At this point it will not care which domain(except for whatever matches in the previous conditional statement) as so long as it matches starts with whatever is in the URI for example it can be /document or /minisites or /msconfig. As you can see it just needs to match the STARTING letters. This is something you might want to consider because it promotes bad entries. Otherwise if it matches it does a redirect and then exists out of the event.
I hope this helps you out.
CB
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
