Forum Discussion
Chris_DiPietro_
Nimbostratus
Mar 08, 2012redirecting urls to add www to the host if it does not exists
I have two VSs one responds to port 80 but redirects to https and one responds to HTTPS, but I want to make sure anyone trying to get to sample.com gets redirected to www.sample.com so the SSL cert ...
hoolio
Cirrostratus
Mar 09, 2012If you want to avoid redirecting IP addresses with www. prepended, you could use something like this:
when HTTP_REQUEST {
Check if Host header starts with a digit (is an IP address)
if {[string match {[0-9]*]} [HTTP::host]}{
HTTP::redirect "https://[HTTP::host][HTTP::uri]"
} else {
HTTP::redirect "https://www.sample.com[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