Forum Discussion
Brandon_11574
Mar 27, 2011Nimbostratus
Special 404 Redirect Rules
We have some sub folders in our site that we want special 404 handling. If there are any 404 errors on any file found under that folder or any of its children folders, we want to employ this 404 hand...
Michael_Yates
Mar 28, 2011Nimbostratus
Sure. You can store them in a Data Group.
(Local Traffic -> iRules -> Data Group List).
You can store them as strings and search through them with a class match.
Try something like this:
when HTTP_REQUEST {
set targethost [HTTP::host]
set targeturi [HTTP::uri]
}
when HTTP_RESPONSE {
if { [HTTP::status] == 400 || [HTTP::status] == 404 } {
if { [class match $targeturi starts_with mydatagroup ] } {
HTTP::redirect "http://$targethost[URI::path $targeturi 1 1]specialPage.aspx"
}
}
}
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