Restrict direct access for url

kindly we need help to build the following scenario through Cloudflare:-

i have 2 domain and

i need to allow the users for access the url when redirect from the url

and deny the users that make direct access to url

Hi @user5754 ,

I don’t think this can be done with Cloudflare Access but I’m not sure


$_SESSION['fromMain'] = "true";
header("Location: noaccess.php");
if($_SESSION['fromMain'] == "false"){
   //send them back
   header("Location: foo.php");
   //reset the variable
   $_SESSION['fromMain'] = "false";

Find more about it here : preventing direct access to a php page, only access if redirected - Stack Overflow

I also recommend to take this type of questions to stack overflow !