Forum Discussion
SS11
Dec 01, 2020Nimbostratus
Add the URI in the redirect URL when the HTTP Response is 404 code
If user trying to access any page/item which is not present (404) then user should be redirected to home page of site like test123/?abcd=<requested item> e.g. test123/xyz (HTTP-404) to test123/?abcd...
SS11
Nimbostratus
Its redirecting to
fdfbglskbvksdfbvlk URI appened in redirect URL but it should be https://test123/?abcd=fdfbglskbvksdfbvlk
Dec 02, 2020
If you want redirect to "https://test123/?abcd=xyz/1234/notfound.aspx"
when HTTP_REQUEST {
set path [string trimleft [HTTP::path] "/"]
}
when HTTP_RESPONSE {
if { [HTTP::status] == 404} {
HTTP::redirect "http://test123/?abcd=$path"
}
}
If you want redirect to "https://test123/?abcd=xyz"
when HTTP_REQUEST {
set val [getfield [HTTP::path] / 2]
}
when HTTP_RESPONSE {
if { [HTTP::status] == 404} {
HTTP::redirect "http://test123/?abcd=$val"
}
}
If you want redirect to "https://test123/?abcd=fdfbglskbvksdfbvlk"
when HTTP_REQUEST {
set val [URI::query [HTTP::uri] item]
}
when HTTP_RESPONSE {
if { [HTTP::status] == 404} {
HTTP::redirect "http://test123/?abcd=$val"
}
}
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