Webmaster Forum

Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Reply
 
Thread Tools Display Modes
Share |
  #1  
Old 07-14-2014, 02:27 AM
WindSplitter1's Avatar
WindSplitter1 WindSplitter1 is offline
Contributing Member
 
Join Date: 07-01-14
Location: Lisbon, Sintra
Posts: 74
iTrader: 0 / 0%
Thumbs up Redirecting users based on Country

Hello everyone!
I have the following sites:

Triplestrata . com

Triplestrata . com . pt

They're both based on WordPress and the thing is... I want Portuguese-native speakers (Brazil and Portugal) to be redirected to the com.pt the latter and the rest of the world be shown the com
.

Is there a script that can help me accomplish this? Thank you!
 
Reply With Quote

Advertisement

Advertisement

  #2  
Old 09-07-2014, 12:34 AM
arunthomas203 arunthomas203 is offline
Contributing Member
 
Join Date: 06-24-14
Posts: 68
iTrader: 0 / 0%
add a checking in the index.php file and set redirection
 
Reply With Quote
  #3  
Old 09-18-2014, 07:04 AM
Dadee Dadee is offline
Banned
 
Join Date: 04-16-13
Posts: 65
iTrader: 0 / 0%
check their user agent language and geoip country and then redirect
 
Reply With Quote
  #4  
Old 09-20-2014, 04:15 PM
WindSplitter1's Avatar
WindSplitter1 WindSplitter1 is offline
Contributing Member
 
Join Date: 07-01-14
Location: Lisbon, Sintra
Posts: 74
iTrader: 0 / 0%
Can you explain it step-by-step?

Thank you.
 
Reply With Quote
  #5  
Old 09-20-2014, 04:29 PM
litespeedhost litespeedhost is offline
Junior Member
 
Join Date: 08-19-14
Posts: 23
iTrader: 0 / 0%
This code might help you
PHP Code:
<?php
require_once("geoIP/geoip.inc");
$gi geoip_open('geoIP/GeoIP.dat'GEOIP_MEMORY_CACHE);
$country geoip_country_code_by_addr($gi$_SERVER['REMOTE_ADDR']);
// prints the country code  your visitor is in
$my_countriesrow = array('AD','AE','AF','AG','AI'.....ect);
$my_countrieseuro = array('AN','AT','BA','BE','BG','BY','CH'.....ect);
/* $my_country = array('GB','UK'); */
if (!in_array(strtolower($country), $my_countriesrow)) {
header('Location: siteurl/index.php');
exit();
}
else if(!
in_array(strtolower($country), $my_countrieseuro)){
header('Location: siteurl/ieuro/index.php');
exit();
}
else {
header('Location: siteurl/iindex.php');
exit();
}
// the end
geoip_close($gi);
?>

Last edited by J. H. Rasmussen; 09-20-2014 at 05:16 PM. Reason: Added PHP-wrapper.
 
Reply With Quote
  #6  
Old 09-22-2014, 08:55 PM
emailhosting's Avatar
emailhosting emailhosting is offline
Contributing Member
 
Join Date: 09-18-14
Posts: 63
iTrader: 0 / 0%
Use an API from www dot geoplugin dot net and get the visitors country name and base from that you can do the redirection.
 
Reply With Quote
  #7  
Old 09-24-2014, 10:30 AM
WindSplitter1's Avatar
WindSplitter1 WindSplitter1 is offline
Contributing Member
 
Join Date: 07-01-14
Location: Lisbon, Sintra
Posts: 74
iTrader: 0 / 0%
Um... I was thinking in a script that would display them a popup message saying.
"Hey, this site is also available in X language". where they could choose to remain in the Y site or X site (with two buttons to one or the other).

Any thought on how can this be accomplished?

Thank you.
 
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Is redirecting users based on their location spam? - GoogleWebmasterHelp HTMLBasicTutor Google Forum 1 10-09-2013 11:46 PM
[country] Moving to another country.. Want to clean up computer.. ImagesGym Tech Talk 7 09-19-2013 01:27 AM
Showing different content based on the user's country IP and google? bwb SEO Forum 9 11-13-2006 02:34 AM
redirecting as per users geo-location funguru Coding Forum 14 08-03-2005 10:03 AM


V7N Network
Get exposure! V7N I Love Photography V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 01:11 PM.
Powered by vBulletin
Copyright 2000-2014 Jelsoft Enterprises Limited.
Copyright © 2003 - 2018 VIX-WomensForum LLC