title: Redirect to Mobile Site with Full Site Link
body: <p>I'm working on setting up a redirect to a mobile landing page for mobile users and the script I'm using is throwing up a 505.</p>
  
  <p>Entire htaccess code is below: (Updated)</p>
  
  <pre><code>&lt;FilesMatch "\.(html|htm|js|css)$"&gt;
  FileETag None
  &lt;IfModule mod_headers.c&gt;
  Header unset ETag
  Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
  Header set Pragma "no-cache"
  Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
  &lt;/IfModule&gt;
  &lt;/FilesMatch&gt;
  
  #MobileSetup
  RewriteEngine On 
  RewriteBase /
  
  RewriteCond %{QUERY_STRING} (^|&amp;)m=0(&amp;|$)
  RewriteRule ^ – [CO=mredir:0:http://www.maindomain.com]
  
  RewriteCond %{HTTP_HOST} !^http://www.maindomain.com/mobile/\.com$ [NC]
  RewriteCond %{REQUEST_URI} !\.(jpg|css|png|gif)$ [NC]
  RewriteCond %{HTTP_USER_AGENT} "android|blackberry|iphone|ipod|iemobile|opera         mobile|palmos|webos|googlebot-mobile" [NC]
  RewriteCond %{QUERY_STRING} !(^|&amp;)m=0(&amp;|$) [NC]
  RewriteCond %{HTTP_COOKIE}  !mredir=0 [NC]
  RewriteRule ^ http://www.maindomain.com/mobile/? [R,L]
  
  #Was at the top
  
  RewriteEngine On 
  RewriteBase /
  
  RewriteRule ^news/([a-zA-Z0-9_-]+)$ /news.php?url=$1 [NC,L]
  
  RewriteCond %{HTTP_HOST} ^maindomain.com$
  RewriteRule ^(.*)$ http://www.maindomain.com$1 [R=301,L]
  
  ErrorDocument 404 /404.php
  
  #Redirects
  Redirect 301 main site redirects
  
  #10.28.13
  Redirect 301 main site redirects
  </code></pre>
  
  <p>I've tried debugging this but to no avail. There is a redirect set up on the server that is forcing a <strong>non-www.</strong> to go to the <strong>www.</strong>.<br>
  Could this be causing an issue?</p>
  
  <p>Thanks for help.</p>