tags:

views:

153

answers:

2

How can I make an auto redirect on my website to my mobile website, when visited from a mobile browser. I would rather not have to create a database.

+2  A: 

Without platform information, it's difficult to make a specific recommendation. The general advice is match some string in the User-Agent that tells you it's a mobile browser (probably multiple patterns will be required) and generate a redirect response.

EDIT: A google search turns up this very comprehensive page on User-Agent strings for mobile devices. Suffice to say, you probably want to restrict your list of patterns to devices you specifically intend to target, and let the rest fall back to your main site.

Marcelo Cantos
+1  A: 

you should check for user agent header via a regexp to find out if it is some kind of mobile devices or not.

take a look here http://detectmobilebrowser.com/

mohamadreza