php - Redirect Loops in Switch Case with header(location) -


<?php  $rexgeoip = new rexgeoip; $iso = strtoupper( $rexgeoip->getcountryiso() );       switch ($iso) {         case 'de':                 header("location: http://www.domain.de/en/",true,301);             break;          case 'at':                 header("location: http://www.domain.de",true,301);              break;          case 'ch':                 header("location: http://www.domain.de",true,301);              break;          default:                 header("location: http://www.domain.de/en/",true,301);         break;     } }  echo "<!-- iso $iso -->";  ?> 

this code redirects corresponding domain path. changed de case /en because i'm in germany , want test redirect. every time hit de iso "to many redirects" timeout. happens if connect via web-proxy or asia.

any ideas or suggestions?

add de path , don't redirect in script responsible http://www.domain.de/de/ or http://www.domain.de/en/:

<?php  $rexgeoip = new rexgeoip; $iso = strtoupper( $rexgeoip->getcountryiso() );   switch ($iso) {     case 'de':             header("location: http://www.domain.de/en/",true,301);             exit;         break;      case 'at':             header("location: http://www.domain.de/de/",true,301);             exit;          break;      case 'ch':             header("location: http://www.domain.de/de/",true,301);             exit;                           break;      default:             header("location: http://www.domain.de/en/",true,301);             exit;     break;   } }  echo "script never gets here";  ?> 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -