URL Restriction based on Host

Hi i want to redirect/ redirect the URL https://www.test.com/user.php. except two IP’s 10.10.10.0/24; 10.20.30.40.

Try this,

when HTTP_REQUEST {
    if { not ( [class match [IP::client_addr] equals allowed_ips] ) } {
        HTTP::redirect "https://www.test.com/user.php"
    } 
}

where “allowed_ips” is an address-based data group. The data group option allows you to more easily modify IP addresses/ranges.