Difference between revisions of "Redirect - Custom 404"
From Tech-Wiki
(Created page with "Category:F5 Networks '''Back to iRules''' when HTTP_RESPONSE { if { [HTTP::status] == "403" } { HTTP::respond 404 content "404 File...") |
|||
Line 12: | Line 12: | ||
Or below | Or below | ||
− | |||
when HTTP_REQUEST { | when HTTP_REQUEST { | ||
set host [HTTP::host] | set host [HTTP::host] |
Latest revision as of 19:52, 20 May 2019
when HTTP_RESPONSE { if { [HTTP::status] == "403" } { HTTP::respond 404 content "404 File Not Found" Mime-Type "text/html" } elseif { [HTTP::status] == "404" } { HTTP::redirect "http://www.customerrorpage.com" } }
Or below
when HTTP_REQUEST { set host [HTTP::host] set path [HTTP::path] } when HTTP_RESPONSE { if { [HTTP::status] eq "404" } { HTTP::redirect "https://${host}/my404page?url=${path}" } }
You CAN'T use host/uri under RESPONSE, like below:
when HTTP_REQUEST { #Redirects all to HTTPS keeps URI intact HTTP::redirect https://[HTTP::host][HTTP::uri] }