Data group redirection or trim the hostname?
I am new to Irule scripting, and have a quick need for an Irule that redirects to a url based on the incoming uri that has an url (possibly encoded) as the first part of the URI. I was going to use an external data group because the list of redirect will be growing in to the 100s.
for example: www.site.com/www.foo.com/content/image.png needs to redirect to : www.foo.com/content/image.png
from other posts I started off with this:
REQUEST { if { [class match [string tolower [HTTP::uri]] starts_with www.site.com.data.group] } { HTTP::redirect "http://[class match -value [string tolower [HTTP::uri]] starts_with www.site.com.data.group]" } }
and the data group has this listed in it: /www.foo.com := www.foo.com.
Am I over complicating this? do I need to use a data group, or can this be done with a simple redirect substitution where we basically trim the host name.
Any help would be much appreciated.