How to redirect random page to home page if page not available

how to redirect random page to home page if page not available like gurukripa.ac.in/random , gurukripa.ac.in/sikar and many more

May I ask if the returning HTTP status code is 404 not found, or some other? :thinking:

I’d use Bulk Redirects from Cloudflare dashboard in that case.

Otherwise, maybe with Cloudflare Workers to detect any of the 404 HTTP status codes being returned, and then either display custom 404 page or redirect all 404 to something different.

Nevertheless, using Page Rules you could achieve this for your case - if it’s only the homepage for example.

https://support.cloudflare.com/hc/en-us/articles/4729826525965-Configuring-URL-forwarding-or-redirects-with-Page-Rules

Most servers have a built-in mechanism for 404 errors. You can set it to either return the home page, or a 404 page with a Meta Refresh to the home page.