The main change to make is replacing redirect to with HTTP::redirect. SAP should be case sensitive also, so you can remove the string tolower. Lastly, the most efficient format for using subnets with the IP::addr command is with CIDR on the network address: