Forum Discussion
Chris_DiPietro_
Mar 08, 2012Nimbostratus
redirecting 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 ...
hooleylist
Mar 09, 2012Cirrostratus
If 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
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