Forum Discussion
ukitsysadmin_95
Nimbostratus
Jun 04, 2009redirect example.xx to www.example.xx
Hello
I'm new to irules, and would love some help on creating an irule for my problem below
Our web farm hosts a single domain name, but multiple geographic suffix's. e....
Colin_Walker_12
Jun 04, 2009Historic F5 Account
So all you need to do is redirect anything that comes in without www to the www prepended version?
That's straight-forward:
when HTTP_REQUEST {
if { !([HTTP::host] starts_with "www.") } {
HTTP::redirect "http://www.[HTTP::host][HTTP::uri]"
}
}
This will take any request coming in to a domain that does not begin with www., and redirect it to the exact same place, but with www. at the beginning of the host name. Of course, this would apply to all domains. If you wanted to limit it to just the domains you listed you could add in a switch statement or a class search, something like that.
Is this what you were looking for?
Colin
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