Hey there StackOverflow Community, i searched a lot on stackoverflow to fix my "too many redirect" Error. But couldn't find anything that helps. I want to redirect to a mobile directory via .htaccess and the UserAgent Condition. Found a high voted Solution that looks like this:
RewriteEngine On RewriteCond %{HTTP_USER_AGENT} "android|blackberry|iphone|ipod|ipad|iemobile" [NC] RewriteRule ^(.*)$ http://mysite.com/mobile/$1 [R=301,L]
The redirect itself works great but its seems like the mobile browsers add /mobile in a loop so the URL grows into something like http://mysite.com/mobile/mobile/mobile/mobile/mobile/mobile/mobile/mobile till i get an Error "couldn't open site because of too many redirects".
My complete .htaccess looks like this:
AddType video/ogg .ogv AddType video/mp4 .mp4 AddType video/webm .webm RewriteEngine On RewriteCond %{HTTP_USER_AGENT} "android|blackberry|iphone|ipod|ipad|iemobile" [NC] RewriteRule ^(.*)$ http://mysite.com/mobile/$1 [R=301,L]
Thanks in Advance, Lucas Tito