title: Mobile redirect with .htaccess but for root domain only
body: <p>I purchased a mobile site theme from a developed on ThemeForest.net and he suggested I speak with the community here about .htaccess.  I currently use .htaccess to redirect mobile traffic to my mobile site, and that works great.  However I have discovered that if someone with a touch device were to try and access a page on my server from either directly typing it in as a URL, or from an external link, it would redirect the user to the index page of my mobile site.</p>
  
  <p>An example; I create a lot of slideshows for Realtors using SlideShowPro Director.  These slideshows are embeded in an HTML page I create.  I send the URL to my Realtors so they can access the slideshows, or link the URL to another site.  If someone using a touch device were to follow that link, the .htaccess file would detect the device and redirect them to the mobile index page, not to the slideshow page.  Obviously something is screwy with the way the file is configured.  The code for the file is as follows:</p>
  
  <pre><code>RewriteEngine on
  RewriteBase /
  
  # Check if this is the noredirect query string
  RewriteCond %{QUERY_STRING} (^|&amp;)m=0(&amp;|$)
  # Set a cookie, and skip the next rule
  RewriteRule ^ - [CO=mredir:0:www.mainevideotours.com]
  
  RewriteCond %{HTTP:x-wap-profile} !^$ [OR]
  RewriteCond %{HTTP:Profile}       !^$ [OR]
  RewriteCond %{HTTP_USER_AGENT} "acs|alav|alca|amoi|audi|aste|avan|benq|bird|blac|blaz|brew|cell|cldc|cmd-" [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} "dang|doco|eric|hipt|inno|ipaq|java|jigs|kddi|keji|leno|lg-c|lg-d|lg-g|lge-" [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} "maui|maxo|midp|mits|mmef|mobi|mot-|moto|mwbp|nec-|newt|noki|opwv" [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} "palm|pana|pant|pdxg|phil|play|pluc|port|prox|qtek|qwap|sage|sams|sany" [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} "sch-|sec-|send|seri|sgh-|shar|sie-|siem|smal|smar|sony|sph-|symb|t-mo" [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} "teli|tim-|tosh|tsm-|upg1|upsi|vk-v|voda|w3cs|wap-|wapa|wapi" [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} "wapp|wapr|webc|winw|winw|xda|xda-" [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} "up.browser|up.link|windowssce|iemobile|mini|mmp" [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} "symbian|midp|wap|phone|pocket|mobile|pda|psp" [NC]
  RewriteCond %{HTTP_USER_AGENT} !macintosh [NC]
  
  # Check if we're not already on the mobile site
  RewriteCond %{HTTP_HOST}          !^m\.
  # Can not read and write cookie in same request, must duplicate condition
  RewriteCond %{QUERY_STRING} !(^|&amp;)m=0(&amp;|$) 
  
  # Check to make sure we haven't set the cookie before
  RewriteCond %{HTTP_COOKIE}        !^.*mredir=0.*$ [NC]
  
  # Now redirect to the mobile site
  RewriteRule ^ http://m.mainevideotours.com [R,L]
  </code></pre>
  
  <p>Any help would be greatly appreciate!!
  -Keith</p>