Hi,

I'm currently trying to work out how my .htaccess file is working for a mobile redirect. Apologies that Iím not that well-informed about using .htaccess, but Iím trying! Here is what my .htaccess file looks like:

Code:
RewriteEngine on
# mobile site redirection
RewriteCond %{HTTP_REFERER} !^http://(.*).mysite.co.uk/.*$ [NC]
RewriteCond %{REQUEST_URI} !^/mobile/.*$
RewriteCond %{HTTP_USER_AGENT} "android|blackberry|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC]
RewriteRule ^(.*)$ /mobile/ [L,R=302]
This is whatís happening:
  1. Visiting "http://mysite.co.uk" redirects me to my mobile page at "http://mysite.co.uk/mobile/", but the page is rendered without CSS, JS or my images.
  2. From this CSS-free mobile page, clicking on a "see the desktop site" link to "http://mysite.co.uk" redirects me to my mobile page a second time at "http://mysite.co.uk/mobile/" but this time with CSS, JS and images!
  3. From this CSS-rendered mobile page, clicking once again on the "see the desktop site" link to "http://mysite.co.uk" redirects me to my desktop site at "http://mysite.co.uk"

Could anyone tell me why the initial mobile redirect doesnít render CSS, JS and images? Iíve made all the src and href attributes for these files absolute, so Iím hoping itís not to do with file paths (and the CSS, JS and images seem to load second time round, anyway).

Many many thanks for any help!