Forum Discussion
mguned_60772
Feb 19, 2010Nimbostratus
URL Rewrite findstr
Trying to do the following:
Redirect -
https://oldsite.com/xxx/xxx/xxx.asp?firststring=FIRSTxxxx_xxxxsecondstring=SECOND
to -
http://newsi...
hooleylist
Feb 22, 2010Cirrostratus
Normally I'd suggest using URI::query to parse the parameter values and then insert them in the redirect. However, there is a bug in the URI::query command (described in this post Click here).
So you could try something like:
elseif { [HTTP::path] eq "/xxx/xxx/xxx.asp" } {
Parse the value of param_one from the URI
if {$query starts_with "param_one="}{
set FIRST [findstr $query "param_one=" 10 &]
log local0. "\$FIRST: $FIRST"
} else {
Parameter wasn't at the start of the query string, so check for ¶m_one= in the query string
Need to hardcode the length of the parameter name + 2 for findstr
set FIRST [findstr $query "¶m_one=" 11 &]
log local0. "\$FIRST: $FIRST"
}
Parse the value of param_2 from the URI
if {$query starts_with "param_2="}{
set SECOND [findstr $query "param_2=" 8 &]
log local0. "\$SECOND: $SECOND"
} else {
Parameter wasn't at the start of the query string, so check for ¶m_2= in the query string
Need to hardcode the length of the parameter name + 2 for findstr
set SECOND [findstr $query "¶m_2=" 9 &]
log local0. "\$SECOND: $SECOND"
}
HTTP::redirect "http://newsite.com/xxx.aspx?xxx=$FIRSTxxx=$SECOND"}
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