1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to redirect website to its mobile version ?

Discussion in 'White Hat SEO' started by yoyo33, Apr 17, 2015.

  1. yoyo33

    yoyo33 Regular Member

    Joined:
    Jan 29, 2011
    Messages:
    269
    Likes Received:
    49
    I search a way to redirect website to it's mobile version.
    It's a simple website html / php / no database. I just want to manually create it's mobile version and upload it to something like m.website.com

    I want this method to be compatible with the google test (to ensure it's ok for the 21 april change)

    I have found this script, but i'm not sure it's the right thing to do....

    Code:
    <script type="text/javascript">
      <!--
      if (screen.width <= 800) {
        window.location = "http://m.domain.com";
      }
      //-->
    </script>
    
    Any ideas?
     
  2. acidol2

    acidol2 Supreme Member

    Joined:
    Sep 8, 2011
    Messages:
    1,322
    Likes Received:
    835
    Location:
    My Successful Future
  3. JOSourcing

    JOSourcing Junior Member

    Joined:
    May 19, 2011
    Messages:
    125
    Likes Received:
    38
    Occupation:
    Writer, Programmer
    Location:
    Sacramento, CA
    Home Page:
    The javascript that you have will do just fine. I have the same thing on my website (which passes Google's mobile test, thank you very much) and it works just great!
     
  4. seapunk

    seapunk Registered Member

    Joined:
    Dec 28, 2014
    Messages:
    85
    Likes Received:
    20
  5. JOSourcing

    JOSourcing Junior Member

    Joined:
    May 19, 2011
    Messages:
    125
    Likes Received:
    38
    Occupation:
    Writer, Programmer
    Location:
    Sacramento, CA
    Home Page:
    Don't do what? And why?
     
  6. JasonS

    JasonS Jr. VIP Jr. VIP

    Joined:
    Sep 15, 2012
    Messages:
    3,034
    Likes Received:
    929
    @OP: you can easily do this via Cloudflare. It has feature to detect mobile devices and redirect to your mobile friendly design.