Forum Discussion
Hi Paulo,
for a redirect within a given website site (aka. same protocol and hostname:port), you don't need to specify the protocol, hostname:port). Redirect destination starting with a / (slash) are always considered relativ to the website root-web.
when HTTP_REQUEST {
if { ( [string tolower [HTTP::host]] equals "subdomain.domain.com" )
and ( [string tolower [HTTP::path]] equals "/identityiq/dashboard/editpreferences.jsf" ) } then {
HTTP::redirect "/identityiq/home.jsf"
}
}
Note: Other interesting redirect shortcuts are "//domain.de/folder/file" (same protocol as before but new host/folder/file), "./file" same protocol, same host, same folder(s) but different file)
Note: You have mentioned that this code has security purposes. Because of that I've added [string tolower] syntax to make the comparsion case insensitive and also changed the matching for the blocked URL to [HTTP::path] equals /.... Without those tweaks the blocking mechanism can be bypassed very easy.
Cheers, Kai