View Single Post
Old 02-26-2012, 06:03 AM  
Varius
Confirmed User
 
Industry Role:
Join Date: Jun 2004
Location: New York, NY
Posts: 6,890
Doing it at the script (PHP, etc...) level is easy, however you probably want the webserver to handle that instead...assuming you use Apache, the key directive you will need is for the randomness: RewriteMap

Example:

let's say you create /my/dir/de_map.txt and it contains this line:

dynamic url1|url2 (as many as you like)

Here could be your Germany for example redirect section:

RewriteMap servers rnd:/my/dir/de_map.txt
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^DE$
RewriteRule ^(.*)$ http://${servers:dynamic}/$1 [P,L]

Of course, you should have your conditions to check whether it's mobile or not as well before that stuff, and make sure MaxMind mod_geoip is installed.

Note: Since its 5am here and Im just tossing this out quick from memory, you may wish to double-check the syntax
__________________
Skype variuscr - Email varius AT gmail
Varius is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote