How to redirect mobile users to a mobile version of my website?

Discussion in 'HTML & Website Design' started by EuroGuy, Jul 10, 2008.

  1. #1
    Hi everybody, is there a way i can automactically redirect people visting my website using a mobile phone to a mobile version of my website? google and amazon can do it, and i use my mobile a lot to surf. so i wondering how i auto redirect without putting a 'click here mobile users' link on every page.
     
    EuroGuy, Jul 10, 2008 IP
  2. rebelagent

    rebelagent Well-Known Member

    Messages:
    876
    Likes Received:
    46
    Best Answers:
    0
    Trophy Points:
    165
    #2
    <?
    $htmlredirect = "Regular Web Page";
    $wmlredirect = "Mobile Web Page";
    if(strpos(strtoupper($HTTP_ACCEPT),"VND.WAP.WML") > 0){
    header("Location: ".$wmlredirect);}
    else{
    header("Location: ".$htmlredirect);
    exit;}

    ?>

    That should work.
     
    rebelagent, Jul 10, 2008 IP
  3. EuroGuy

    EuroGuy Guest

    Messages:
    91
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thanks rebelagent! that goes in the head of my homepage? and how does the redirect work?
     
    EuroGuy, Jul 10, 2008 IP
  4. rebelagent

    rebelagent Well-Known Member

    Messages:
    876
    Likes Received:
    46
    Best Answers:
    0
    Trophy Points:
    165
    #4
    anywhere I usually put it towards the top.
    I tried to test it on my t-mobile dash but it wasnt working. It worked on my t619 though.

    If you have any future problems with wap, I use http://www.2wap.org/forums
    Quite resourceful
     
    rebelagent, Jul 10, 2008 IP
  5. AshDaFlash

    AshDaFlash Peon

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I have found that a lot of mobile redirecting scripts need to be updated constantly and always include Iphones in the redirecting process. If anyone is interested, I've uploaded a PHP script to the following website:

    Go to: http://www.pcmechanix.ca/mobile_redirect.htm

    If you would first like to test the code using a mobile device then input the following url into your mobile browser:

    http://www.pcmechanix.ca

    Good Luck!
     
    AshDaFlash, May 21, 2009 IP