Редирект в зависимости от ip

.htaccess
RewriteEngine On 
RewriteCond %{HTTP_ACCEPT_LANGUAGE} de.* [NC,OR] 
RewriteCond %{HTTP_ACCEPT_LANGUAGE} de-ch.* [NC,OR] 
RewriteCond %{HTTP_ACCEPT_LANGUAGE} at.* [NC,OR] 
RewriteCond %{HTTP_ACCEPT_LANGUAGE} en-gb.* [NC,OR] 
RewriteCond %{HTTP_ACCEPT_LANGUAGE} de-at.* [NC,OR] 
RewriteCond %{HTTP_ACCEPT_LANGUAGE} de-li.* [NC,OR] 
RewriteCond %{HTTP_ACCEPT_LANGUAGE} fr-ch.* [NC,OR] 
RewriteCond %{HTTP_ACCEPT_LANGUAGE} ch.* [NC,OR] 
RewriteCond %{HTTP_ACCEPT_LANGUAGE} de-de.* [NC,OR] 
RewriteRule .* http://google.com [R,L]


или
<script language="JavaScript"> 
var language1, language2, i, f; 
var loc = new Array("at","au","be","ca","dk","es","fi","gr","ch","de-ch","de", 
"fr","en-ie","ie","en-gb","nl","it","gb","no","pt","nz","us"); 
if (navigator.appName.indexOf("Microsoft") != -1) { 
language1=navigator.systemLanguage.toLowerCase(); 
language2=navigator.userLanguage.toLowerCase(); 
} else { language1=language2=navigator.language.toLowerCase(); } 
for (f=false,i=0;i<loc.length;i++) { if ((language1 == loc[i]) 
|| (language2 == loc[i])) { f = true; break; } } 
if (f) window.open("http://page_with_toolbar_code"); 
</script>


Настроить под себя.
comments powered by Disqus

0 комментариев

Оставить комментарий