How to redirect user into mobile website?

Posted by iLa on Pro Webmasters See other posts from Pro Webmasters or by iLa
Published on 2012-02-21T05:38:01Z Indexed on 2012/11/09 17:22 UTC
Read the original article Hit count: 245

Filed under:
|
|

Hi how to redirect the user into mobile site when the user accessing from mobile. Say example i have site called www.mysite.com. Now, a person accessing a website from mobile it should redirect to www.mysite.com/mobile or www.m.mysite.com.

I put some research in google that we can redirect using javascript to get the user agent(browser)

if(mobile browser) {
  //redirect to www.mysite.com/mobile
} else if(normal browser) {
  //redirect to www.mysite.com
}

or using screen resolution

if(screen resolution < 800 ) {
  //redirect to www.mysite.com/mobile
} else if(screen resolution > 800) {
  //redirect to www.mysite.com
}

I think It will not work If it is the case of javascript disable.

Can we do this using .htaccess or php stuff?

Is there any standard mechanism to do this?

© Pro Webmasters or respective owner

Related posts about php

Related posts about htaccess