How can my site detect mobile phones and switch visitors to a mobile Domain?

How can my site detect mobile phones and switch visitors to a mobile Domain? - If a page has internal and external outgoing links to redirecting URLs, it’s returning 3xx (301, 302, etc.) HTTP status codes standing for redirection. This issue means that the page does not exist on a permanent or temporary basis. It appears on most of the popular web browsers, usually caused by a misconfigured website. However, there are some steps you can take to ensure the issue isn’t on your side. You can find more details about redirecting URLs by reading the Google Search Central overview. In this article, we’ll go over how you can fix the How can my site detect mobile phones and switch visitors to a mobile Domain? error on your web browser. Problem :


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.


Solution :

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




Simple




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";

//-->
</script>



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!)



require_once('[mobile_device_detect.php][4]');
mobile_device_detect(
'http://iphone-url.com',
'http://ipad-url.com',
'http://android-url.com',
'http://opera-mini-url.com',
'http://blackberry-url.com',
'http://palm-os-url.com',
'http://mobile-url.com',
'http://mobile-browsers-url.com',
'http://desktop-url.com');


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...



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)) 

We hope that this article has helped you resolve the redirects, dns, 301-redirect error in your web browsers. Enjoy browsing the internet uninterrupted!

Comments

Popular posts from this blog

What is the SEO impact of multiple redirects that return to the current page after setting a cookie?

How to redirect to any domain [duplicate]

"302 found" for index page bad for SEO?