Forum Discussion
Krzysztof_52486
Jun 17, 2012Nimbostratus
Redirect non www to www and http to https in one irule?
Hi all,
Is possible to in one irule redirect www to non www and http to https?
Ony one address are valid: https://host.domain.pl
but some users try to access: http://host.domain....
nathe
Jun 17, 2012Cirrocumulus
KP
Could this work:
when HTTP_REQUEST {
Check if the host starts with www.
if {[string tolower [HTTP::host]] starts_with "www."}{
Redirect with the www. prefix removed to the same URI
HTTP::redirect "https://[string range [HTTP::host] 4 end][HTTP::uri]"
} else {
Redirect to https for http://host.domain.pl
HTTP::redirect "https://[HTTP::host][HTTP::uri]"
}
}
First bit re www taken from: https://devcentral.f5.com/Community/GroupDetails/tabid/1082223/asg/50/aft/1178449/showtab/groupforums/Default.aspx
Hope this helps
N
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