Türkiye'nin En Eski Webmaster Forumu İyinet'e Hoşgeldiniz!

Ülkeye Göre Sayfa Açma

muratozcirpici

0
Onaylı Üye
Üye
Katılım
9 Eylül 2004
Mesajlar
1,324
Açılan Konu
44
Tepki puanı
0
Konum
Adana
Selam ;

yapacağım site de ülke ayrımı yapmasını istiyorum.
yani tr ip den biri girdiği zaman tr/index.asp ye yönlenecek.
diğer bütün dünyadan girenlerde ise en/index.asp ye yönlenecek.

asp sistemi altında olacak yani php yok :)

bunu nasıl yapacam? acil yardım....
 

yoktur

0
Onaylı Üye
Üye
Katılım
28 Ekim 2004
Mesajlar
2,366
Açılan Konu
90
Tepki puanı
1
Konum
/etc/istanbul.c
Ben phpsini yazayım sen asp ye uyarla :p

<?php
if(strstr($HTTP_ACCEPT_LANGUAGE,"en")) {
Header("Location: http://www.site.com/site");
}
elseif(strstr($HTTP_ACCEPT_LANGUAGE,"en-us")) {
Header("Location: http://www.site.com/site");
}
elseif(strstr($HTTP_ACCEPT_LANGUAGE,"de")) {
Header("Location: http://www.site.com/de/");
}
elseif(strstr($HTTP_ACCEPT_LANGUAGE,"tr")) {
Header("Location: http://www.site.com/site/turkce/");
}
elseif(strstr($HTTP_ACCEPT_LANGUAGE,"it")) {
Header("Location: http://www.site.com/site/Italiano/");
}
elseif(strstr($HTTP_ACCEPT_LANGUAGE,"es")) {
Header("Location: http://www.site.com/site/spain/");
}
elseif(strstr($HTTP_ACCEPT_LANGUAGE,"fr")) {
Header("Location: http://www.site.com/site/Fran%c3%a7ais/");
}
else {Header("Location: http://www.site.com/site");
}
?>
 

oyuncu

0
Onaylı Üye
Üye
Katılım
30 Ekim 2002
Mesajlar
602
Açılan Konu
26
Tepki puanı
1
ip bazlı daha iyi sonuç verir, öncelikle ip kontrol edecek türk ipsi değilse TR lang kontrolü ile yabancı ülkedeki türkleride alacak
 

muratozcirpici

0
Onaylı Üye
Üye
Katılım
9 Eylül 2004
Mesajlar
1,324
Açılan Konu
44
Tepki puanı
0
Konum
Adana
sağolun arkadaşlar...

asp ye nasıl uyarlicaz şimdi :)

yoktur senin verdiğini şöyle kullanırız.

<?php
if(strstr($HTTP_ACCEPT_LANGUAGE,"tr")) {
Header("Location: http://www.site.com/tr/index.asp");
}
else {Header("Location: http://www.site.com/en/index.asp");
}
?>

Bu şekilde yapınca herhalde dili türkçe olanlar tr ye giriyor diğerleri en e girmiş oluyor..
şimdi sıra geldi bunu asp yapmaya :) hadi bakalım bunu kim yapabilir ?
 

yoktur

0
Onaylı Üye
Üye
Katılım
28 Ekim 2004
Mesajlar
2,366
Açılan Konu
90
Tepki puanı
1
Konum
/etc/istanbul.c
ip aralıgı tabiki daha iyi ama çok geniş bir ip dilim aralığı var boşuna cpu tüketimi yapar. $HTTP_ACCEPT_LANGUAGE çok daha mantıklı
 

yoktur

0
Onaylı Üye
Üye
Katılım
28 Ekim 2004
Mesajlar
2,366
Açılan Konu
90
Tepki puanı
1
Konum
/etc/istanbul.c
walla yardım etmek isterdim ama beynimin asp kısmına format çektim.
14 satır asp kodu ile yaptıgım şeyi tek satır php ile yapabildigimi ögrendigim gün formatı bastım asp ye :p
3 senedir asp ile ilgilenmiyorum
i love you PHP
 
S

ShadowSong

Misafir
Söylediğin şekilde ip aralığına değilde browser diline göre yönlendirme olsa daha iyi olur diye düşünüyorum bende ama asp yorumlamak yerine çok kolay bir java ile bu işi halledebilirsin. (ASP yorumlamıyorum çünki session tagı açıyor ve yönlendirilen sayfada inc yada DB bağlantısı varsa sayfanın geç açılmasına yol açıyor.)


Kod:
<!-- ONE STEP TO INSTALL LANGUAGE:

  1.  Copy the coding into the HEAD of your HTML document  -->

<!-- STEP ONE: Paste this code into the HEAD of your HTML document  -->

<HEAD>

<SCRIPT LANGUAGE="JavaScript1.2">
<!-- Begin
if (navigator.appName == 'Netscape')
var language = navigator.language;
else
var language = navigator.browserLanguage;

/*-------------------------------------------------------------
Netscape instructions:  
In Netscape, find the language you want to redirect by going to

Edit Menu --> Preferences...

Then click the '+' box next to 'Navigator' and click 'Languages'
Click 'Add' then find the languages you want and add them below.

---------------------------------------------------------------

Microsoft Internet Explorer instructions:  
In MSIE, find the language you want to redirect by going to

Tools Menu --> Internet Options...

Then click the 'Languages' button near the bottom of the page.
Click 'Add' then find the languages you want and add them below.

-------------------------------------------------------------*/

if (language.indexOf('en') > -1) document.location.href = 'English.html';
else if (language.indexOf('nl') > -1) document.location.href = 'dutch.html';
else if (language.indexOf('fr') > -1) document.location.href = 'french.html';
else if (language.indexOf('de') > -1) document.location.href = 'german.html';
else if (language.indexOf('ja') > -1) document.location.href = 'japanese.html';
else if (language.indexOf('it') > -1) document.location.href = 'italian.html';
else if (language.indexOf('pt') > -1) document.location.href = 'portuguese.html';
else if (language.indexOf('es') > -1) document.location.href = 'Spanish.html';
else if (language.indexOf('sv') > -1) document.location.href = 'swedish.html';
else if (language.indexOf('zh') > -1) document.location.href = 'chinese.html';
else 
document.location.href = 'English.html';
// End -->
</script>

<p><center>
<font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>

<!-- Script Size:  1.95 KB -->
 

sitemedya

0
Onaylı Üye
Üye
Katılım
11 Kasım 2004
Mesajlar
284
Açılan Konu
7
Tepki puanı
0
muratozcirpici' Alıntı:
sağolun arkadaşlar...
asp ye nasıl uyarlicaz şimdi :)
bu şekilde... :)
Kod:
response.buffer=true ' <-- bu satır kod sayfasının en üstünde olmalı
ulkekodu = request.servervariables("HTTP_ACCEPT_LANGUAGE")
select case ulkekodu
	case "en": link="link_en.asp"
	case "en-us": link="link_enus.asp"
	case "de": link="link_de.asp"
	case "tr": link="link_tr.asp"
	case "it": link="link_it.asp"
	case "es": link="link_es.asp"
	case "fr": link="link_fr.asp"
	case else link="link_nop.asp"
end select
response.redirect link ' ilgili sayfaya yonlendirme yapılması için
 

muratozcirpici

0
Onaylı Üye
Üye
Katılım
9 Eylül 2004
Mesajlar
1,324
Açılan Konu
44
Tepki puanı
0
Konum
Adana
sitemedya ve shadowsong teşekkürler.. ikisini de deneyeceğim :)

sağolun...
 

bay_okan

0
Onaylı Üye
Üye
Katılım
22 Temmuz 2008
Mesajlar
128
Açılan Konu
13
Tepki puanı
1
Konum
Çorum
Arkadaşlar peki bunu wp de nereye atacagız ??
 
Üst