Forum Discussion
Mike_61640
Nimbostratus
Feb 20, 2009Redirect based on URI content
I have a couple of different requirements for a redirect.
I'm trying to first check the host name and if it doesn't include www in it, I need it added (i.e http://company.com should be http://www.company.com).
The second piece is that if the URI contains a "." in it then it should be redirected to a different to a diffrent host site.
Example: http://company.com/images.gif should be redirected to http://sub.company.com/imgages.gif
I'm brand new to iRules, but I have found some examples for the first part and I've been trying to hack my way through it, it just doesn't seem to be working.
1 Reply
- JRahm
Admin
Issue 1:
This will redirect the client:if { [domain [HTTP::host] 2] equals [HTTP::host] } { HTTP::redirect www.[HTTP::host] }
This will just fix the header, with no change in client's perspective:if { [domain [HTTP::host] 2] equals [HTTP::host] } { HTTP::header replace Host "www.[HTTP::host]" }
Issue 2:
Is this also for the same rule as Issue 1? If so, in which order should they be evaluated? it can't be sent to both www and sub.
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
