I need an iRule to redirect the illegal URLs requests ( not included in the ASM Allowed URLs list) to my home page instead of the reject page with the support ID.
consider my home page is : homepage.com
I assume your ASM policy includes not only URL-checking, but also other violation checks. But if just illegal URL-requests should be redirected, I would try to create a dedicated policy for this and configure "Redirect URL" as "Response Type" under "Security ›› Application Security : Blocking : Response Pages".
Details are depending on your overall policy-design and -requirements, but it should point you in the right direction.
Ciao Stefan :)
You might want to check http response code 403, 5xx, if irule detect those http response code, then redirect traffic to your home page.