My Question is that when user enter the website: http://www.example.com then they will just go to automatically to http://www.example.mobi how can i do this .. is their any technique behind that.

Can i do this via cPanel etc?. Tutorial links are welcomed.

2 Answers 2


To redirect only mobile traffic to a mobile domain there are a few options:-


Based on screen resolution (my favorite as it's fairly future proof)

<script type="text/javascript">
if (screen.width <= 699) {
document.location = "www.mobileurl.com";

More granular control

http://detectmobilebrowsers.mobi/ offers more complete control with a free script which handles redirection to a single place, or multiple places based on device (don't be fooled by all the buy buttons!)


Allowing traffic from different devices to be sent to different urls.

Extremely granular control

Other than that there are device description databases like WURFL which offer even more in depth control by providing a database that can be queried using device header information and traffic redirected accordingly...

  • is this helpful technique and i don't understood full, is this redirect the main domain. means if some one open in web-browser on the laptop/desktop computer then its not show .mobi domain but if some one enter to the mobile devices they have to redirect to the .mobi domain .. i just want that ... Mar 13, 2012 at 17:09
  • @AppzVenture Oh, I see, you want to redirect ONLY mobile traffic to a mobile domain? Different kettle of fish, I'll update my answer Mar 13, 2012 at 17:27
  • @AppzVenture updated with a few solutions for you... Mar 13, 2012 at 17:48
  • Thanks thats really helpfull its solve lot of my time and investment. Thanks too much Mar 23, 2012 at 13:16
  • @AppzVenture No worries. Mar 23, 2012 at 13:19

The first method (screen.width<=799) is not reliable. On my Android, I get a screen width of 540 when the phone is being held upright (portrait view), but if I turn it on its side (landscape view), I get width=960. Better (maybe still not fully reliable) might be to bounce to mobile if either dimension is small:

if ((screen.width <= 699) || (screen.height <= 699)) {}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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