How do i redirect to mobile version website?

9 replies
Hi guys,
been trying to find info on how to set up a mobile version of my website. I am hosted with Hostgator - shared servers.
I know that i must place a redirect script on my homepage that redirects mobile browser users to mob version. Hostgator couldn't tell me how.
I see this www.m.domainname.com on such sites. So how do i set this up?
I will be building mobile site with jquery mobile and hoping there is a simple cms i can use too.
Any help much appreciated thanks!
#mobile #redirect #version #website
  • Profile picture of the author Jay Moreno
    hi londoncoffee

    There are several approaches you can take using that include user agent detection and screensize detection. You can implement these methods using php, asp, javascript, and htaccess files.

    All have pros and cons and different ways to implement them but the simplest is probably a javascript redirect which you can put in the header of you website.

    We provide a redirect for wordpress that offers lots of additional features to more than just a simple redirection.

    For now though give this a try place it right before the </head> tag on your page - change the yourdomainhere.com to wherever you want it to redirect too.

    This is primarily a very simple javascript based screen size detect and redirect modified to work with android that we put together.

    Code:
    <script type="text/javascript">
    if (screen.width < 1024 || navigator.userAgent.toLowerCase().indexOf('android')!=-1)
    (window.location.replace("http://www.yourdomainhere.com"));
    </script>
    Hope that helps

    Jay
    Signature
    Sorry, I am too busy helping people to think of a cool signature!
    {{ DiscussionBoard.errors[6159236].message }}
  • Profile picture of the author londoncoffee
    Thanks Jay,
    i have copies that script cheers!
    But i am still not sure how to set up a mobile version and whether i use a sub domain or a folder in domain root. Also, read something about having to create an m domain name and changing cname at the dns. Do you know anything about this method?
    {{ DiscussionBoard.errors[6159463].message }}
    • Profile picture of the author dsouravs
      i have wills mobile script.
      i can make one site for u
      Signature

      I can convert your Non-Responsive website to Responsive website ... How sweet is that? :)

      {{ DiscussionBoard.errors[6160210].message }}
    • Profile picture of the author sbucciarel
      Banned
      Originally Posted by londoncoffee View Post

      Thanks Jay,
      i have copies that script cheers!
      But i am still not sure how to set up a mobile version and whether i use a sub domain or a folder in domain root. Also, read something about having to create an m domain name and changing cname at the dns. Do you know anything about this method?
      For a Wordpress site, I use WPTouch Pro plugin. Just install and forget it. It redirects and does all the work for you.

      For a static html site, I use a subdomain like m.domain.com for the mobile site, use the script in the main site head to redirect it. For building it, I have mobile templates that I use to build them.
      {{ DiscussionBoard.errors[6161622].message }}
  • Profile picture of the author Brader
    You can use the WordPress Plugin if your site WordPress based
    {{ DiscussionBoard.errors[6160298].message }}
  • Profile picture of the author londoncoffee
    Thanks guys,
    I am building it myself!
    but nobody has answered my question. Where do i place a jquery mobile version of main site with the domain www.m.domainname.com?
    Oh well. I guess if Hostgator couldn't tell me, who can?
    {{ DiscussionBoard.errors[6160981].message }}
  • Hi LondonCoffee, until now all the mobile sites I developed are based on Wordpress installation, and to get automatic link to the right version of the blog I use a plugin named WPTouchPro, suggested also by Sbucciarel.

    I started to use it because it was advised in a mobile frenzy wso, but I didn't remember thy name... Anyway it's very simple to use because you need just to select the version of website for any cell phone operative system, including iOs, Androis, Symbian, Windows Phone and so on.

    See you soon,
    Alessandro
    {{ DiscussionBoard.errors[6161745].message }}
  • Profile picture of the author Jay Moreno
    hi londoncoffee your webhosting company should provide you with a control panel of some sort to configure your hosting, many companies similar to hostgator will use something like cPanel...

    basically once you access you cpanel there are options to park domains, add subdomains etc, clicking on add a subdomain will give you step by step prompts and guide you through the process... a m subdomain typically just points to a m subfolder with your hosting

    let me know who you are currently hosting with and i can probably help you out a little better

    cheers

    jay

    ps it wouldnt actually be www.m.domain.com it would be just m.domain.com or to be strictly correct http://m.domain.com
    Signature
    Sorry, I am too busy helping people to think of a cool signature!
    {{ DiscussionBoard.errors[6163603].message }}
  • Profile picture of the author acharyabbs
    good information now i will try to redirect mt site for mobile version also..
    {{ DiscussionBoard.errors[6163675].message }}

Trending Topics