31-Aug-2020 12:58
Hi,
i need help with redirect irule:
if user type the valid uri:
https://mysite.com/work/validpage1 redirect to https://othersite.com/pages
https://mysite.com/work/validpage2 redirect to https://othersite.com/pages
but if user type any gargage sites or misspell sites (not valid sites):
https://mysite.com/work/garbage1 redirect to https://mysite.com
https://mysite.com/work/abcdefg1 redirect to https://mysite.com
https://mysite.com/work/valiydpage1 redirect to https://mysite.com
i appreciate your help.
Thanks
31-Aug-2020 13:47
Hi Hien Truong,
when HTTP_REQUEST {
set host [HTTP::host]
set uri [string tolower [HTTP::uri]]
}
when HTTP_RESPONSE {
if { $host eq "mysite.com" && $uri starts_with "/work/" } {
if { [HTTP::status] eq "200" } {
HTTP::redirect "https://othersite.com/pages"
}
else {
HTTP::redirect "https://mysite.com"
}
}
}
02-Sep-2020 21:48
thanks for your reply.