Forum Discussion
f5now_28704
Nimbostratus
Aug 29, 2007301 redirects
Hi Guys.
I have a question, with my iRule set, I have about 40 domains going to one Virtual Server(192.168.1.200).
Now Marketing wants to redirect 301, 10 domains of the 40.
...
Aug 29, 2007
Sure thing. You can either put all the domains you want redirected into a class (Data Group). Look at the wiki for matchclass and you'll see an example. Or, you could hard code it in your iRule with a switch statement
when HTTP_REQUEST {
switch [HTTP::host] {
www.domain1.com -
www.domain2.com -
www.domain3.com -
www.domain4.com -
www.domain5.com -
www.domain6.com -
www.domain7.com -
www.domain8.com -
www.domain9.com -
www.domain10.com {
HTTP::respond 301 Location "http://www.abc.com[HTTP::uri]"
}
}
}
I've removed your "getfield" command as it will always return "www.abc.com" since there is no ":" in that string. You want to use the getfield command in this situation when you are working drectly on the HTTP::host where the client enters something like this:
In this case HTTP::host will be "www.foo.com:80" and you'll need to do the getfield to extract "www.foo.com".
-Joe
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
