Forum Discussion
Grayson_149410
Nimbostratus
Sep 29, 2015irule remove "www."
Does anyone have an iRule that will remove the "www." part of a URL? I tried the following iRule, but it does not work.
when HTTP_REQUEST {
if { [HTTP::uri] equals "https://www.abc.xyz.com" } {
...
Brad_Parker
Cirrus
Sep 29, 2015Try this:
when HTTP_REQUEST {
if {[string tolower [HTTP::host]] starts_with "www."}{
HTTP::redirect "https://[string map {www. ""} [string tolower [HTTP::host]]]"
}
}
Brad_Parker
Cirrus
Sep 29, 2015if you want to keep the original URI use this
when HTTP_REQUEST {
if {[string tolower [HTTP::host]] starts_with "www."}{
HTTP::redirect "https://[string map {www. ""} [string tolower [HTTP::host]]][HTTP::uri]"
}
}
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
