Forum Discussion
ukitsysadmin_95
Jan 17, 2011Nimbostratus
Old URL 404, compare URI with external data group file
Hello all, I was wondering if someone could help me or point me in the correct direction. I have about 40,000 URL's and growing which need redirecting, here is an...
hooleylist
Jan 21, 2011Cirrostratus
Maybe something like this for 9.4.4 - 9.4.x:
when HTTP_REQUEST {
Save the path to a variable in case we see a 404 from the server
set path [HTTP::path]
}
when HTTP_RESPONSE {
if {[HTTP::status] == 404} {
Parse the string after the last forward slash
set uri_token [string range $path [expr {[string last / $path] + 1}] end]
If that string wasn't null, look it up in the datagroup
if {$uri_token ne ""}{
set red_uri [findclass $uri_token class_name " "]
Use the second field in the matching datagroup line to redirect the client
if {$red_uri ne ""}{
HTTP::redirect $red_uri
}
}
}
}
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