Forum Discussion
hooleylist
Jan 18, 2008Cirrostratus
Hi,
Here would be an equivalent to the apache rewrite rule:
Evaluate the regex against the HTTP host and URI.
Save the 5 backreferences to match1 through match5 for later use
regexp {^/([a-z])ws/wfs([a-z]+)_([0-9]+)/(wfs|wms)/(.*)$} [HTTP::host][HTTP::uri] m1 m2 m3 m4 m5
log local0. "New Host: hostname"
HTTP::header replace Host "hostname"
Escape the variable name using curly braces where necessary
log local0. "New URI: /wfs${m2}_$m3/$m4/$m5"
HTTP::uri /wfs${m2}_$m3/$m4/$m5
You can use the regexp command (Click here), to evaluate the regex and save the matches into backreferences. To set the HTTP host header, you can use 'HTTP::header replace Host $new_value'. To set the URI, you can use HTTP::uri $new_uri. If you wanted to send the client a redirect, instead of rewriting the host or URI, you could use 'HTTP::redirect $fully_qualified_url'.
You don't have an exact match to the syntax of Apache's mod_rewrite, but there is equivalent functionality using iRules.
Aaron