Forum Discussion
yihwen_100254
Jun 14, 2011Nimbostratus
Generic iRule to redirect domain.com to www.domain.com
Hi
I am planning to create an generic iRule to perform a http://domain.com to https://www.domain.com I know in the F5 v10.x.x, there is a _sys_https_redirect and that will actually redirect ...
hooleylist
Jun 14, 2011Cirrostratus
You can try something like this to redirect any request with a host header that doesn't start with www and is not an IP address to https://www< host >:
when HTTP_REQUEST {
Check if host doesn't start with www and has at least one alpha character
if { not ([string tolower [HTTP::host]] starts_with "www") and [string match {[a-zA-Z]} [HTTP::host]] }{
Redirect to the same host via https with www. prepended
HTTP::redirect "https://www.[HTTP::host][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