What lines of code would I enter in the .htaccess perform the redirect only if the target is the homepage? That is the main question here. I'll elaborate:
I used the method described at: Mobile Redirect using htaccess to redirect mobile. Works great. Now, what my client is trying to do is when someone is on mobile, if they are trying to access a page that is not the homepage (i.e. a blog), then they do NOT get redirected. So, if the target is the homepage, the redirect works as normal. Make sense?
So, I'll simplify it again -- what lines of code would I enter in the .htaccess perform the redirect only if the target is the homepage?
Here is what I have (minus the detection part)
RewriteCond %{REQUEST_URI} ^/index.php$ [OR]
RewriteCond %{REQUEST_URI} ^/$
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]
#there is a bunch of other user agents #
# 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} !(^|&)m=0(&|$)
# 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.thesiteurl.com [R,L]