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.
- JRahm
Admin
Issue 1:if { [domain [HTTP::host] 2] equals [HTTP::host] } { HTTP::redirect www.[HTTP::host] }
if { [domain [HTTP::host] 2] equals [HTTP::host] } { HTTP::header replace Host "www.[HTTP::host]" }
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