Redirecting from home directory to error page using some conditions

I am trying to redirect all requests reporting back a 404 to a custom webpage further down the directory, under some conditions (for example, if the default language of the user is found to be greek, it redirects them to the greek version of the site, and the same thing happens if the browser’s default language is english)

Until now I’ve tried:

/* /en/404 404 Language=en
/* /gr/404 404 Language=el
/ /en/404 404 Language=en
/ /gr/404 404 Language=el
* /en/404 404 Language=en
* /gr/404 404 Language=el
/* /en/404 404
/* /gr/404 404
* /en/404 404
* /gr/404 404

None of these have helped, and in fact they broke the entire _redirect ruleset

site link: Persa Costa - Home

using cloudflare as my domain

At least in your current setup, Netlify is redirecting correctly, but it looks like you might have a client-side JavaScript that’s forcing us to go to /gr

I am visiting your home page, getting redirected to /en but the address bar shows /gr only with JavaScript enabled. That sounds like a code issue.