Feb 05, 2010
One Vs for Redirects
This should be an easy one..
I want to use one VS for a bunch of redirects, a catch all of sorts.. If for some reason this is a bad idea just let me know.
The redirect on...
www.my.foo.com www.foo.com
Where the following rule should redirect you to the www.foo.com domain if they come in with www.my.foo.com:
when HTTP_REQUEST {
set Host [findclass [HTTP::host] your_datagroup_name " "]
if { $Host ne "" } {
HTTP::redirect $Host[HTTP::uri]
}
}
I've not tested the iRule above but it should get you very close. I'd add an else statement to handle hosts that don't match.
HTH,
-Matt