the redirection back to the website's home page does not occur - it allows the user to download the PDFs.
does request come with referer header? if it does not exist or null, it will be allowed (to download pdf), won't it?
if { $refer_host == "" || [matchclass $refer_host contains referer_allowed_hosts] } {
return
}
by the way, since you are running 11.6.0, you should replace global variable and matchclass with static global variable and class command.
static
https://devcentral.f5.com/wiki/iRules.static.ashx
class
https://devcentral.f5.com/wiki/iRules.class.ashx