Forum Moderators: phranque
I have a problem with htaccess. Hoping someone here could help me solve it, I describe here the scenario.
1. I want to redirect specific mobile user-agents to mobile top page.
2. I want to redirect normal users and crawlers from the mobile site to the normal pc site.
I have the following in my .htaccess file.
Options +FollowSymlinks
RewriteEngine On
### Redirect PC domain to mobile domain according to user-agent with exemption
RewriteCond %{HTTP_HOST} ^(www\.)?example\.co\.jp [NC]
RewriteCond %{REQUEST_URI} !^(/m/?).*$ [NC]
RewriteCond %{HTTP_USER_AGENT} "DoCoMo¦KDDI¦J-PHONE¦Vodafone¦SoftBank¦UP\.Browser¦MOT" [NC]
RewriteRule ^(.*)$ http://www.example.co.jp/m/index.html [R=301,L]
### If /m/~ is requested by other user agents than the ones below, redirect to top page
RewriteCond %{REQUEST_URI} ^(/m/?).*$ [NC]
RewriteCond %{HTTP_USER_AGENT} !"DoCoMo¦KDDI¦J-PHONE¦Vodafone¦SoftBank¦UP\.Browser¦MOT" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} !"Y!J-SRD¦Y!J-MBS¦Googlebot-Mobile¦ichiro/mobile¦LD_mobile_bot¦symphonybot1\.froute\.jp" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} !"SNVSE00000001¦i-robot¦KDDI-Googlebot-Mobile¦MSNBOT-MOBILE¦BaiduMobaider¦Google-Sitemaps" [NC]
RewriteRule ^(.*)$ http://www.example.co.jp/ [R=301,L]
Everything under /m/ directory corresponds to mobile site.
The above code seems to work fine on my test server but when I upload the code to my production server, it trows a 403 error when accessing the site from one of the User-agents specified in the rules (Vodafone for example).
My test server is Apache/2.2.3 (Red Hat)
My production serer is Apache/1.3.27 (Unix)
I someone could help me, would be very much appreciated. I'm trying to find out if something in my rules is not compatible with apache 1.3.x
Thanks.