title: Mobile Device Detection with htaccess
body: <p>I created a mobile application available using the following link :</p>
  
  <pre><code>www.mysite.com/mobile.php
  </code></pre>
  
  <p>my issue is to detect the mobile version when I use the link of the site <code>www.mysite.com</code> and redirect me using htaccess to the link of my mobile application <code>www.mysite.com/mobile.php</code>.</p>
  
  <p>I notice that the application is developed with Symfony1.4</p>
  
  <p>In all layouts of my mobile application I use this html code in the top :</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt; 
  </code></pre>
  
  <p> 
   
       
      
      </p>
  
  <p>Edit : </p>
  
  <p>here is my htaccess after modification : </p>
  
  <pre><code>&lt;IfModule mod_rewrite.c&gt;
  RewriteEngine On
  RewriteCond %{QUERY_STRING} ^(%2d|-)[^=]+$ [NC]
  RewriteRule ^(.*) $1? [L]
  &lt;/IfModule&gt;
  
   Options +FollowSymLinks +ExecCGI
  
   &lt;IfModule mod_rewrite.c&gt;
   RewriteEngine On
  
   # uncomment the following line, if you are having trouble
   # getting no_script_name to work
   RewriteBase /
  
   # we skip all files with .something
   #RewriteCond %{REQUEST_URI} \..+$
   #RewriteCond %{REQUEST_URI} !\.html$
   #RewriteRule .* - [L]
  
   # we check if the .html version is here (caching)
   RewriteRule ^$ index.html [QSA]
   RewriteRule ^([^.]+)$ $1.html [QSA]
   RewriteCond %{REQUEST_FILENAME} !-f
  
   # no, so we redirect to our front web controller
   RewriteRule ^(.*)$ index.php [QSA,L]
  
   RewriteEngine on
   RewriteCond %{HTTP_USER_AGENT} iphone|ipad|android|blackberry [NC]
   RewriteRule ^$ /mobile.php
  
   &lt;/IfModule&gt;
  </code></pre>
  
  <p>But it dosn't work!</p>
  
  <p>I don't hope something very defficult,I wish change the htaccess above to have that scenario:</p>
  
  <p>I access to the link <code>www.mysite.com</code>(the same link in 2 cases ) :</p>
  
  <p>1- to see my principal site, htaccess point on the front controller <code>index.php</code> by default.</p>
  
  <p>2- If I visit the mobile version, htaccess will detect it and point me on the front controller <code>mobile.php</code> to redirect me directly to app mobile.</p>