Mobile Redirect via ModReWrite Simple code

is it possible to just use this simple code for the redirection of ALL mobile phones?

RewriteEngine On   
RewriteCond %{HTTP_USER_AGENT} .*(iPad|iPhone|Mobile).* 
RewriteRule .* http://website.com/ [R]

since Android and Symbian and BB have "Mobile" in their strings.

or should the UserAgents be explicitly listed out like here: http://www.projectronin.com/blog/?p=10

thanks

Answers


If possible, redirect based on screen resolution or OS, not specific model of device. Keeping a model-specific list up to date is impossible.

Also, the above solution will always redirect them to the mobile site. Sometimes users want to use the full site on their mobile devices. For that reason, I would handle this in your site's code, not in htaccess.

Put something like this in your front controller, or a controller plug-in -- any bit of code that is executed on every page request in the non-mobile version/module of your site:

if(!isset($session->non_mobile)){ $session->non_mobile = false; }

if($_GET[non-mobile]){ $session->non_mobile = true; }

if(is_mobile_browser() && $session->non_mobile == false))
{
   header('location: http://m.yoursite.com');//redirect to mobile version
}

Need Your Help

using urllib.request to get stock data

python multithreading performance urllib2

I wrote the following code to retrieve data about stocks in the S&P 500. The code works, but it is very slow due to the number of urlopen requests. What strategies can I use to speed this up?...

#SEQ keyword in Asp.Net Charting control with multiple Azure Cloud app instances

asp.net asp.net-mvc azure charts

I am having a simple Azure cloud app(WebRole=ASP.Net MVC) which draws charts using ASP.Net Charting control.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.