Mobile redirect with .htaccess for www.example.com OR example.com
===

I'm going to be starting on a mobile version of my website soon, already have space set up for it as follows:

http://mobile.example.com/

I found a solution here:
http://stackoverflow.com/questions/9421577/best-way-to-redirect-mobile-devices

^ This seems to work just fine except when I try this from my iphone4 it will only redirect if I enter the www in the url.. if I leave it out I just get my regular site.

So I need the mobile redirect to work if the user enters www.example.com OR example.com

I made some modifications to the code and got it almost working.  Now it works for both versions of the url but I have to refresh once to get the mobile site. Obviously I want the redirect to work when they first hit the site.  I'm sure I'm missing something here, let me know what you think. I have aplus.net as my host btw.

    RewriteCond %{HTTP_HOST} ^(www\.example\.com|example\.com) [NC]
    RewriteCond %{HTTP_USER_AGENT} "android|blackberry|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC]
    RewriteRule ^(.*)$ http://mobile.example.com/$1 [L,R=302]


