Hi korai,
try this:
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] == "abcsite" && [string tolower [HTTP::host]] ends_with ".pdf" } {
HTTP::respond 301 Location "https://xyz/details/overview[HTTP::uri]"
}
}
It was not working because you use [HTTP::host] in order to check an URI
use [HTTP::host] for check host
and [HTTP::uri] in order to check an uri
so in the irule that i provid you i checked that the host is abcsite and the uri end with ".pdf".
you can add an additional condition in order to validate that the uri begin with "/documents/":
when HTTP_REQUEST {
if { ([string tolower [HTTP::host]] == "abcsite") && ([string tolower [HTTP::host]] ends_with ".pdf") && ([string tolower [HTTP::uri]] starts_with "/documents/") } {
HTTP::respond 301 Location "https://xyz/details/overview[HTTP::uri]"
}
}
Regards