Good htaccess mobile redirect code?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • getcontentnow
    Registered User
    • Jun 2014
    • 61

    #1

    Good htaccess mobile redirect code?

    Can somebody help me with an "uptodate" mobile redirect code for .htaccess?

    I did google it, but theres to much crap out there.
    Mike Glass
    Icq: 652387948
  • gebu
    Confirmed User
    • Jun 2013
    • 249

    #2
    RewriteEngine On
    RewriteRule \.(jpg|png|gif|jpeg|bmp)$ - [L]
    RewriteCond %{HTTP_USER_AGENT} (mobile|android|blackberry|brew|cldc|docomo|htc|j2 me|micromax|lg|midp|mot|motorola|netfront|nokia|ob igo|openweb|opera.mini|palm|psp|samsung|sanyo|sch| sonyericsson|symbian|symbos|teleca|up.browser|voda fone|wap|webos|windows.ce) [NC]
    RewriteRule ^(.*)$
    http:// yoururl. com [R=302,L]

    Comment

    • Matyko
      PsyHead
      • Aug 2005
      • 8681

      #3
      this is a good code gebu posted, but don't do this. Get your mobile traffic a proper landing page On Your Site. Otherwise Google will fuck your site's ass.
      -=- Register with our ref link and we help you with the setup! -=-
      AdSpyglass.com - Double your profit from brokers

      Comment

      • campartner
        Registered User
        • Aug 2011
        • 37

        #4
        Originally posted by getcontentnow
        Can somebody help me with an "uptodate" mobile redirect code for .htaccess?
        Hi mike

        No Need to redirect.I got what you need.
        Please ping me on skype.

        skype id CPRenato
        Best Dating and Cam Affiliate Program for your German traffic!
        Campartner.com

        Comment

        • Ferus
          Bye - Left to do stuff
          • Feb 2013
          • 4108

          #5
          Originally posted by Matyko
          this is a good code gebu posted, but don't do this. Get your mobile traffic a proper landing page On Your Site. Otherwise Google will fuck your site's ass.
          This +1.
          As fast as possible

          Comment

          • AlexTmz
            Confirmed User
            • Sep 2005
            • 2435

            #6
            Use mobile pop code, dont use mobile redirect
            Best banners/native ads and POPUPS with no any shit - Exoclick
            Selling quality hardlinks/menu tabs/contextual links: from good aged sites
            contact email:mastermich {here} gmail In com

            Comment

            • Paul&John
              Confirmed User
              • Aug 2005
              • 8643

              #7
              Originally posted by matyko
              this is a good code gebu posted, but don't do this. Get your mobile traffic a proper landing page on your site. Otherwise google will fuck your site's ass.
              +1
              .
              .
              .
              Use coupon 'pauljohn' for a $1 discount at already super cheap NameSilo!
              Anal Webcams | Kinky Trans Cams Live | Hotwife XXX Tube | Get your Proxies here

              Comment

              • Jel
                Confirmed User
                • Feb 2007
                • 6904

                #8
                Originally posted by Matyko
                this is a good code gebu posted, but don't do this. Get your mobile traffic a proper landing page On Your Site. Otherwise Google will fuck your site's ass.
                it depends what page(s) you are using it on... not all traffic is se traffic

                Comment

                • getcontentnow
                  Registered User
                  • Jun 2014
                  • 61

                  #9
                  Thanks for the code!
                  Its for redirecting the mobile traffic to the .m version of the same website.
                  Mike Glass
                  Icq: 652387948

                  Comment

                  • Matyko
                    PsyHead
                    • Aug 2005
                    • 8681

                    #10
                    Originally posted by getcontentnow
                    Thanks for the code!
                    Its for redirecting the mobile traffic to the .m version of the same website.
                    There are better solutions to make this happen. For example we use this on a very simple site, Above <head> !! :

                    <?php
                    if(! empty($_SERVER['HTTP_USER_AGENT'])){
                    $useragent = $_SERVER['HTTP_USER_AGENT'];
                    if( preg_match('@(iPad|iPod|iPhone|Android|BlackBerry| SymbianOS|SCH-M\d+|Opera Mini|Windows CE|Nokia|SonyEricsson|webOS|PalmOS)@', $useragent) ){
                    header('Location: ./mobile/');
                    }
                    }
                    ?>

                    This redirects users to domain.com/mobile

                    But you can also determine a screen width in css to show the mobile site if the width is smaller than xxx pixels... Not sure how this works, but others will help to finetune this method
                    -=- Register with our ref link and we help you with the setup! -=-
                    AdSpyglass.com - Double your profit from brokers

                    Comment

                    • HowlingWulf
                      Confirmed User
                      • Nov 2001
                      • 1662

                      #11
                      Can also make CSS changes by screen width:
                      Code:
                      @media only screen and (max-width: 1440px) { }  /* small desktop */
                      
                      @media only screen and (max-width: 1280px) { }  /* laptop */
                      
                      @media only screen and (max-width: 1024px) { }   /* tablet landscape */
                      
                      @media only screen and (max-width: 768px) { }     /* tablet portrait */
                      
                      @media only screen and (max-width: 480px) { }    /* mobile landscape */
                      
                      @media only screen and (max-width: 320px) { }   /* mobile portrait */
                      WP Porn directory/review theme Maddos $35.

                      webmaster AT howling-wulf.com

                      Comment

                      • hdbuilder
                        Confirmed User
                        • Jun 2012
                        • 1338

                        #12
                        Just go there and grab the one you need:

                        Detect Mobile Browsers - Open source mobile phone detection

                        ROBO SCRIPTS | WP CAM PLUGIN - Scripts To Promote Cam Sites - Chaturbate, BongaCams, Streamate, LiveJasmin, Stripchat...

                        The Cam Site Builder, The Cam Multi Site Builder -> MULTIPLE CAM SITES IN ONE

                        Comment

                        • Matyko
                          PsyHead
                          • Aug 2005
                          • 8681

                          #13
                          Listen to HowlingWulf
                          -=- Register with our ref link and we help you with the setup! -=-
                          AdSpyglass.com - Double your profit from brokers

                          Comment

                          Working...