Wednesday, 7 August 2013

How to redirect all touch devices to a different site?

How to redirect all touch devices to a different site?

I have created a rather complex Superscrollorama animation whith a few
responsive breakpoints as well, and it works smoothly on most screen
sizes. However, Safari (and as such, Chrome for iOS) works a bit
differently, so I had to use a script called iScroll. Even on the mobile
page for Superscrollorama John mentions that this solution is quite
resource-heavy and should only be used with smaller stuff. Now, my
animation almost won't scroll on my iPad 4 or iPhone 5, so I guess I'm a
bit over the "smaller stuff" thing. That's sad. I really wanted to be able
to say that I went full responsive. :)
However, I would like to offer a decent solution for mobile users too. I
have an index.php for the main site, and an index2.php for mobile users.
.htaccess files are Chinese for me, can you give me some help? I'd need
the following to happen:
Desktop users get what index.php gives them and the URL bar shows mydomain.co
Mobile users get what index2.php gives them and the URL bar still shows
mydomain.co
I had the following code and I even renamed index2.php to index.php and
put it inside /mobile, but it somehow does not work:
RewriteCond %{REQUEST_URI} !^/mobile/.*$
RewriteCond %{HTTP_USER_AGENT}
"android|blackberry|ipad|iphone|ipod|iemobile|opera|mobile|palmos|webos|googlebot-mobile"
[NC]
RewriteRule ^(.*)$ /mobile/$1 [R=301,L]

No comments:

Post a Comment