Too many redirects occurred with php referer code

Hi guys :slight_smile: i have a problem with redirect code and it says on mobile devices too many redirects occurred. Any solution with this code please?

also index page added

<?php include ("gez.php"); ?>

i just want block to pc users to enter site and just let mobiles phones can access. Any solution like this?


$mobile = array(  
    'Windows Phone',
    'Windows Phone',
    'Opera Mini',

if (preg_match('@('.implode('|', $mobile).')@si', $_SERVER['HTTP_USER_AGENT']) ){ 
//if mobile enter the site  
} else { //if pc back to google



If you’re on that URL, you should not send another Location header.

If this code is being called from the index of your site, it will check for mobile, redirect to the index page…which will load the code again, and do the check again, and redirect again…which will…(repeat ad-infinitum)


This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.