Forum Discussion
Pav_70755
Sep 20, 2011Nimbostratus
HTTP Re-Direct uri replace?
I have the following rule written
when HTTP_REQUEST {
if { [HTTP::uri] contains "?storyId=" } {
pool STAGE_directmarketing.thomsonnet.co.uk-80
...
Pav_70755
Sep 21, 2011Nimbostratus
HI Brian,
Just tried it and it works although you are right after testing more links its trimming other characters from the uri... what would be the way to do it using regsub? or defining the 3 variables win, talk and find?
this is what I have atm now, how can I get this to work with the previous rule?
when HTTP_REQUEST {
if { [HTTP::uri] starts_with "/win" } {
set wininsert [string trimleft [HTTP::uri] /win]
HTTP::redirect "http://www.news.com/News-Advice/$wininsert"
}
elseif { [HTTP::uri] starts_with "/Win" } {
set wininsert [string trimleft [HTTP::uri] /Win]
HTTP::redirect "http://www.news.com/News-Advice/$wininsert"
}
elseif { [HTTP::uri] starts_with "/talk" } {
set talkinsert [string trimleft [HTTP::uri] /talk]
HTTP::redirect "http://www.news.com/Marketing-Services/$talkinsert"
}
elseif { [HTTP::uri] starts_with "/Talk" } {
set talkinsert [string trimleft [HTTP::uri] /Talk]
HTTP::redirect "http://www.news.com/Marketing-Services/$talkinsert"
}
elseif { [HTTP::uri] starts_with "/find" } {
set findinsert [string trimleft [HTTP::uri] /find]
HTTP::redirect "http://www.news.com/Business-Data/$findinsert"
}
elseif { [HTTP::uri] starts_with "/Find" } {
set findinsert [string trimleft [HTTP::uri] /Find]
HTTP::redirect "http://www.news.com/Business-Data/$findinsert"
}
else {
pool STAGE_www.news.comk-80
}
}
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