How to redirect to mobile version of website?
I am having a website www.example.com and I am planning to design a new website for mobile users m.example.com. But how to redirect mobile users from main website to mobile version of website?
Look into User_Agents. This class prtty much does it for you: https://code.google.com/p/php-mobile-detect/
That code helped in me in detecting the device. But how to redirect the to the mobile version. Can you help me in doing that?
What is your definition of mobile users?
- if you mean users with specific device, such as iphone, do User Agent detection and redirect user using header location.
Thanks. But I am new to web designing. So can you help me with an example of both?
First detect if the device is mobile or not.
Use the ua-parser library for that,
Next redirect using php headers or meta redirect.
Most modern mobile browsers like android, ios and blackberry support php header based redirect.
for older mobile browsers meta redirect should work
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)