We Recommend

Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems
Wicked Cool PHP contains a wide variety of scripts to process credit cards, check the validity of email addresses, template HTML, and serve dynamic images and text.


Posted By

fris on 01/04/08


Tagged

php redirect country web


Versions (?)


Who likes this?

4 people have marked this snippet as a favorite

luman
vali29
vincent
AlastairDewar


redirect traffic based on language of surfer


Published in: PHP 


i did not write this, credit goes to someone else

  1. <?php
  2. $lang=split('[,;]',$_SERVER['HTTP_ACCEPT_LANGUAGE']);
  3. $lang=strtoupper($lang[0]);
  4. $lang=split('[-]',$lang);
  5. if (($lang[0]=="ZH") or ($lang[0]=="UY") or ($lang[0]=="BO")) {
  6. header('Location: http://www.domain.com/landingpage.html');
  7. }
  8. ?>

Report this snippet 

You need to login to post a comment.