SamiK_85475
Jan 09, 2011Nimbostratus
Changing the host name, part of the URI and then redirect
Hello,
I've seen lots of ideas close to what I'm trying to accomplish, but I still seem to run into problems. I hope you can help.
I'm trying catch all http requests, if the host name contains "acb.com" and if the URI starts with "/se", and redirect them to www.xyz.com/sv/orginal_uri_without_/se . Thus /se/"rest of the uri" needs to be replaced with /sv/"rest of the uri".
E.g. any.abc.com/se/pages/index.htm -----> www.xyz.com/sv/pages/index.htm
Here's what I have:
when HTTP_REQUEST {
if { [HTTP::host]} contains "acb.com"
if { [HTTP::uri] starts_with "/se" } {
HTTP::uri "/sv[string range $uri 3 end]"
HTTP::redirect ]
}
}
I'm fairly new with iRules so any help to make this work would be great!
Thanks,
Sami