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 19, 2011Cirrostratus
You can use some string commands to get the string after the last forward slash:
% set uri /abc/def/ghi/jkl/mno
/abc/def/ghi/jkl/mno
% string range $uri [expr {[string last / $uri] + 1}] end
mno
So you could parse the last field of the HTTP::path in HTTP_REQUEST, save it to a variable (set uri_token [string range [HTTP::path] [expr {[string last / [HTTP::path]] + 1}] end]) and then check in HTTP_RESPONSE for a 404 status. You could then do a lookup against a string datagroup to get the updated URI. You could either retry the request using HTTP::retry to hide the change or send a 301 redirect and have the client see the change and make a new request.
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