Forum Discussion
f5now_28704
Nimbostratus
May 21, 2009redirecting URI and passing extra URI...
ok guys not irules can do this but....
--below is working irule--
when HTTP_REQUEST {
if { [string tolower [HTTP::uri]] starts_with "/freetrial/tabid/121/default.aspx?referrer=www.yahoo.com&keywords=&landingpage=dealercenter" } {
HTTP::redirect "/dealerCenter7/presentation/agreement/dealersignup.aspx?referrer=www.yahoo.com&keywords=&landingpage=dealercenter"
}
if { [string tolower [HTTP::uri]] eq "/freetrial/tabid/121/default.aspx?referrer=www.msn.com&keywords=&landingpage=dealercenter" } {
HTTP::redirect "/dealerCenter7/presentation/agreement/dealersignup.aspx?referrer=www.msn.com&keywords=&landingpage=dealercenter"
}
if { [string tolower [HTTP::uri]] eq "/freetrial/tabid/121/default.aspx?referrer=www.google.com&keywords=dealercenter&landingpage=dealercenter" } {
HTTP::redirect "/dealerCenter7/presentation/agreement/dealersignup.aspx?referrer=www.google.com&keywords=&landingpage=dealercenter"
}
Now, I wanted to have something like this...
if { [string tolower [HTTP::uri]] starts_with "/freetrial/tabid/121/default.aspx?" } {
HTTP::redirect "/FreeTrial.aspx"-(add everything after the ? to this URI)-
}
so /freetrial/tabid/121/default.aspx?referrer=www.google.com&keywords=dealercenter&landingpage=dealercenter
would be /freetrial.aspx?referrer=www.google.com&keywords=dealercenter&landingpage=dealercenter
thanks for any help
stuck in a hotel.
2 Replies
- hoolio
Cirrostratus
You can use HTTP::query (Click here) to get the current query string value:if { [string tolower [HTTP::uri]] starts_with "/freetrial/tabid/121/default.aspx?" } { HTTP::redirect "/FreeTrial.aspx?[HTTP::query]" }
Also, RFC2616 states that the Location value in a redirect must be a fully qualified URL, but most people ignore this as most browsers assume the current protocol and host if one isn't specified.
Aaron - f5now_28704
Nimbostratus
Sweet, the HTTP::query worked 100%. Im currently running thru my irules to see if we can work this with others,
Thanks Hoolio!
Ryan
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
