I am building a website that looks beautiful in Web but worst in mobiles. I want to build the same site but different designing for mobile. Whenever user opens site.com then it auto redirect to m.site.com OR site.com/mob only if on mobile.

  • 1
    Whatever solution you choose, please let the user explicitly switch between the mobile and desktop version of the site. It's quite frustrating when the mobile version has less functionality than the desktop site, or when resizing my desktop browser window to 200px messes up the layout. The user knows best what they need. – amon Mar 21 '16 at 7:54
  • When they will open in mobile it will say "Please download our app", thats what i want. Because its a gaming site. – Ahmad Taha Mar 22 '16 at 4:17

There are 3 ways to implement a mobile website:

  1. Responsive Web Design: Serves the same HTML code on the same URL regardless of the users’ device (desktop, tablet, mobile, non-visual browser), but can render the display differently (i.e., “respond”) based on the screen size. Responsive design is Google’s recommended design pattern.
  2. Dynamic serving: Uses the same URL regardless of device, but generates a different version of HTML for different device types based on what the server knows about the user’s browser.
  3. Separate URLs: Serves different code to each device, and on separate URLs. This configuration tries to detect the users’ device, then redirects to the appropriate page using HTTP redirects] along with the Vary HTTP header.

You can choose any method suitable to your requirements and project. There are both pros and cons of each, so I will recommend spending time on the decision.

  • @AhmadTaha these are the only way, not an option. You can develop the mobile website. you can make the redirect to m. or any other folder on your website using .htaccess file or global.cs file in asp.net case – Pankaj Upadhyay Mar 23 '16 at 7:31
  • Oh sorry i didnt saw the 2,3. Really sorry. And thanks for the answer – Ahmad Taha Mar 24 '16 at 4:29

Read more about HTTP. You probably should take into account the User-Agent: header.

It would be different on mobiles and on desktops (and would vary from one browser to the next).

A clever user would probably be able to fake it, but few people do that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.