Mobile Users Redirect to Mobile Site | PHP |

Discussion in 'Web Programming' started by Gastelum, Apr 13, 2018.

  1. Gastelum

    Gastelum New Member

    Users who visit our website with mobile devices are able to redirect to my mobile site. Hemi is a simple but very simple if structured thing. To tell you the truth, I've been looking for it a lot. To do this, add index.php to your site. If you want to direct your mobile to a different location on your site, add it to ☺;
    If you change this code and type in MacOS or Windows, you can redirect those who called pc


    Code:
    <? Php
    $ iphone = strpos ($ _ SERVER ['HTTP_USER_AGENT'], "iPhone");
    $ android = strpos ($ _ SERVER ['HTTP_USER_AGENT'], 'Android');
    $ webOS = strpos ($ _ SERVER ['HTTP_USER_AGENT'], 'webOS');
    $ bberry = strpos ($ _ SERVER ['HTTP_USER_AGENT'], 'BlackBerry');
    $ ipod = strpos ($ _ SERVER ['HTTP_USER_AGENT'], "iPod");
    if ($ iphone || $ android || $ webos || $ ipod || $ bberry == true)
    {
    echo "<script> window. ******** = 'http: //www.websiteniz.com/mobilsite' </ script>";
    }
    ?>
    webOS It is usually those who enter from the television that I recommend them to other sites
     

Share This Page