Forum Discussion
Joe_Pipitone
Mar 02, 2011Nimbostratus
Regex
I've been requested to perform a rewrite / redirect which does the following:
http://subdomain.ourcompany.com/webext/01.aspx?status=error (pass the 01 over to the url below and say id=thatNu...
hooleylist
Mar 03, 2011Cirrostratus
Another option would be to extract the web object and extension using URI::basename:
http://devcentral.f5.com/wiki/default.aspx/iRules/URI__basename.html
when HTTP_REQUEST {
Check if URI starts with /webext and there is a query string parameter named status set to "error"
if {[string tolower [HTTP::uri]] starts_with "/webext" and [URI::query "?&[HTTP::query] &status] eq "error"}{
Parse 000file.ext from /path/to/000file.ext and save the leading digits to the $id variable
where 000 is one or more digits and file.ext is any string
scan [URI::basename [HTTP::uri]] {%[0-9]%s} id rest
if {$id ne ""}{
log local0. "Scanned $id from $uri"
HTTP::redirect "http://[HTTP::host]/post/post.ashx?id=${id}&status=error"
}
}
}
Aaron
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