Forum Discussion
JonasD_46068
Nimbostratus
Mar 15, 2007REDIRECTION ISSUE
I got the following iRule from someone in this forum:
when HTTP_REQUEST {
set userhost [HTTP::host]
if { $userhost == "testdomain.org"} {
set userhost "www.[HTTP::host]"
...
Colin_Walker_12
Mar 30, 2007Historic F5 Account
I think what you're looking for is something like:
when HTTP_REQUEST {
set userhost [HTTP::host]
if { $userhost equals "testdomain.org"} {
set userhost "www.[HTTP::host]"
} elseif { $userhost equals "ml.testdomain.org"} {
set userhost "[HTTP::host]"
} elseif { $userhost equals "testdomain.net"} {
set userhost "www.[HTTP::host]"
}
HTTP::redirect "https://$userhost[HTTP::uri]"
}Note that the way you're manipulating userhost changes depending on what it was set to coming from the client. If you see subdomain.testdomain.org, you're not going to want to prepend a www to it. If you see just testdomain.org or testdomain.net, then you will.
Make sense?
Colin
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