Forum Discussion
jrosales2000_10
Nimbostratus
Dec 01, 2009Using Priorities in irules
Hi, i am trying to accomplish the following:
1) if user enters abc.com redirect to https://www.abc.com
2) if user enters www.abc.com redirect to https://www.abc.com
...
hoolio
Cirrostratus
Dec 02, 2009So you could redirect all requests to https://www.[base domain name]/ where the base domain name is whatever the client entered with www. added if it's not there already? If that sounds about right, I think this should work for your scenario:
when HTTP_REQUEST {
Check if host starts with www.
if {[string tolower [HTTP::host]] starts_with "www."}{
Redirect client with same host and URI to https
HTTP::redirect "https://[HTTP::host][HTTP::uri]"
} else {
Redirect client with www. prepended to host and same URI to https
HTTP::redirect "https://www.[HTTP::host][HTTP::uri]"
}
}
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