Zeus server doesn't redirect on RewriteCond HTTP_USER_AGENT rule

1.5k views Asked by At

I can't get this redirect to function:

RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_USER_AGENT} iPad|iPod|iPhone|Android|s+Mobile
RewriteRule .* mobile.php

I'm testing it using my Android phone, and also using the user-agent switcher in Google Chrome dev version.

I tried AllowOverride All but it makes the server, running Zeus, reply with an access denied message.

It is a shared host and so I do not really have access to any server logs that I know about.

2

There are 2 answers

1
Jason Weber On

Redirect mobile browsers

RewriteCond %{HTTP_USER_AGENT} ^.*iPhone.*$
RewriteRule ^(.*)$ http://m.example.com [R=301]
RewriteCond %{HTTP_USER_AGENT} ^.*iPad.*$
RewriteRule ^(.*)$ http://m.example.com [R=301]
RewriteCond %{HTTP_USER_AGENT} ^.*Android.*$
RewriteRule ^(.*)$ http://m.example.com [R=301]
RewriteCond %{HTTP_USER_AGENT} ^.*BlackBerry.*$
RewriteRule ^(.*)$ http://blackberry.example.com [R=301]
RewriteCond %{HTTP_USER_AGENT} ^.*IEMobile.*$
RewriteRule ^(.*)$ http://ie.example.com [R=301]
0
Jason On

The problem was that i was running Zeus... not apache. It doesn't support .htaccess.

see: How can I rewrite URLs in the Zeus web server for Mobile useragent?