How to redirect page to pc and wap

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How to redirect page to pc and wap

    hey guys i search the forum tried a lot of sources but failed.

    i need the code like: if a user visit the site from internet explorer it will redirect to web page.if a user visit the site from mobile phone then it will redirect to wml page.if a user visit the site from opera using mobile it will also redirect to the wml page.and if a user visit the site using firefox also have addon for wml support will also go to the wml page otherwise if don't have then pc.and all the browser using pc do not support wml will be directed to the pc web page.and if the browser support wml it will redirect to wml page.

    #2
    Originally posted by bijaybd View Post
    hey guys i search the forum tried a lot of sources but failed.

    i need the code like: if a user visit the site from internet explorer it will redirect to web page.if a user visit the site from mobile phone then it will redirect to wml page.if a user visit the site from opera using mobile it will also redirect to the wml page.and if a user visit the site using firefox also have addon for wml support will also go to the wml page otherwise if don't have then pc.and all the browser using pc do not support wml will be directed to the pc web page.and if the browser support wml it will redirect to wml page.
    let me search for you because u cant !!

    click on this link

    sigpic

    Comment


      #3
      it won't work perfect as i want it . i didn't where to put the url for pc users.

      Comment


        #4
        Detect Mobile Browsers - Mobile User Agent Detection

        Comment


          #5
          PHP Code:
          <?php

          global $userBrowser;

          // Your wapsite

          $wmllink "wap/index.php";

          // Your website

          $htmllink "web/index.php";


          //Detect the browser
          $userBrowser $_SERVER['HTTP_USER_AGENT']; 


          //echo $userBrowser;

          if(strpos(strtoupper($HTTP_ACCEPT),"VND.WAP.XHTML+XML") > 0)
          {
            
          $ub="PC";
          }
          else if(
          strpos(strtoupper($HTTP_ACCEPT),"XHTML+XML") > 0)
          {
            
          $ub="PC";
          }
          //Check for Mozilla
          else if(stristr($userBrowser'Mozilla')) 
          {
            
          $ub="PC";
          }
          //Check for msie
          else if(stristr($userBrowser'msie')) 
          {
            
          $ub="PC";
          }
          //Check for IE
          else if(stristr($userBrowser'internet explorer')) 
          {
            
          $ub="PC";
          }
          //Check for opera
          else if(stristr($userBrowser'opera')) 
          {
            
          $ub="pc";
          }
          //Check for Opera
          else if(stristr($userBrowser'Opera')) 
          {
            
          $ub="pc";
          }
          else
          {
            
          $ub="WML";
            }
          if(
          $ub == "PC") {
              
          header("Location: ".$htmllink);
              exit;
              }
              else 
              {
              
          header("Location: ".$wmllink);
              exit;
              }    
          ?>
          i have also tried this won't work

          Comment


            #6
            this will work :D

            Code:
            //Define your mobile website alternative
            $site = "http://ursitename.com/xhtml";
            
            //Defines the user browser
            $agent = $_SERVER['HTTP_USER_AGENT'];
            
            //Check for various mobile browsers and redirect if confirmed
            if (eregi("mozilla", $agent)) {
            header( "Location: $site" ) ;
            }
            if (eregi("internet explorer", $agent)) {
            header( "Location: $site" ) ;
            }
            if (eregi("Blazer", $agent)) {
            header( "Location: $site" ) ;
            }
            if (eregi("Plucker", $agent)) {
            header( "Location: $site" ) ;
            }
            if (eregi("AvantGo", $agent)) {
            header( "Location: $site" ) ;
            }

            Comment


              #7
              Originally posted by bijaybd View Post
              PHP Code:
              <?php

              global $userBrowser;

              // Your wapsite

              $wmllink "wap/index.php";

              // Your website

              $htmllink "web/index.php";


              //Detect the browser
              $userBrowser $_SERVER['HTTP_USER_AGENT']; 


              //echo $userBrowser;

              if(strpos(strtoupper($HTTP_ACCEPT),"VND.WAP.XHTML+XML") > 0)
              {
                
              $ub="PC";
              }
              else if(
              strpos(strtoupper($HTTP_ACCEPT),"XHTML+XML") > 0)
              {
                
              $ub="PC";
              }
              //Check for Mozilla
              else if(stristr($userBrowser'Mozilla')) 
              {
                
              $ub="PC";
              }
              //Check for msie
              else if(stristr($userBrowser'msie')) 
              {
                
              $ub="PC";
              }
              //Check for IE
              else if(stristr($userBrowser'internet explorer')) 
              {
                
              $ub="PC";
              }
              //Check for opera
              else if(stristr($userBrowser'opera')) 
              {
                
              $ub="pc";
              }
              //Check for Opera
              else if(stristr($userBrowser'Opera')) 
              {
                
              $ub="pc";
              }
              else
              {
                
              $ub="WML";
                }
              if(
              $ub == "PC") {
                  
              header("Location: ".$htmllink);
                  exit;
                  }
                  else 
                  {
                  
              header("Location: ".$wmllink);
                  exit;
                  }    
              ?>
              i have also tried this won't work
              this is what i'm using and it's working fine
              My Blog: http://jhommark.blogspot.com
              My Facebook: http://www.facebook.com/jhommark
              My Official Site: http://www.undergroundweb.tk
              My Community Site: http://undergroundwap.xtreemhost.com

              Comment


                #8
                yep but not with mobile and pc .. i just want like if browser accpet wml den it will redirect to wml site whatever it is from pc or mobile and if the browser do not support wml it will redirect to pc site

                Comment

                Working...
                X