Need help with htaccess mobile and country redirect

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cybermike
    Confirmed User
    • Jan 2002
    • 4121

    #1

    Need help with htaccess mobile and country redirect

    Ok this is what I use to redirect mobile traffic

    #redirect mobile browsers

    RewriteCond %{HTTP_USER_AGENT} ^.*iphone|ipod|ipad|blackberry|android|sgh|sonyeri csson|psp|mot|htc|lg|nokia|palm|treo|j2me|webos|sm artphone|symbian.*$ [NC]
    RewriteRule ^(.*)$ RewriteRule .* http://domain/mobile/ [R=302,L]

    Now how do I keep my US/Canada traffic to going to http://domain.com/mobile and have the following countries go to http://domain.com/mobile2

    Germany
    France
    Sweden
    etc

    I'm not having much luck messing around with php I rather do this in htaccess

    Thanks
    Hey surfers how about some The Best Porn Sites
  • fuzebox
    making it rain
    • Oct 2003
    • 22353

    #2
    Easiest way for you would be to use the free maxmind country database: http://www.maxmind.com/app/geolitecountry

    Ask your host to install mod_geoip, and then you can add the geoip stuff to your htaccess files alongside the mobile redirection.

    http://www.maxmind.com/app/mod_geoip

    Comment

    Working...