Forum Discussion
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