Forum Discussion
slackwaresuppor
Nimbostratus
May 28, 2008stripping data
how would i strip the www. off of www.domain.com??
Deb_Allen_18
May 29, 2008Historic F5 Account
Ouch, please let's not go with regsub to solve such a simple problem. Very pretty all on one line & everything, but very expensive command to invoke regardless how simple the operation itself might be.
Why not simply use the "domain" command:
when HTTP_REQUEST {
HTTP::redirect "https://www.domain1.com/nsa/+homePage=[domain [HTTP::host] 2]"
}which will return only the last 2 parts of any domain name.
If you truly need to operate only on those domains with www. prefix, then use the starts_with operator to condition the change as in colin's example:
when HTTP_REQUEST {
if { [HTTP::host] starts_with "www." } {
HTTP::redirect "https://www.domain1.com/nsa/+homePage=[domain [HTTP::host] 2]"
} else {
HTTP::redirect "https://www.domain1.com/nsa/+homePage=[HTTP::host]"
}
}
/deb
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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