Multilanguage and Location Complexity in International Websites
The ChallengeProblem analysis 	The SolutionGeoIP, Cookies, .htaccess, Proxy websitesLinks/References
The ChallengeContent sections of the website different for the available countries An user from Germany will enter in the German section of the website with content in German languageIf the user from Germany prefer the content from the UK section  and Polski language, on his return he will enter directly on the UK section of the website with content in PolskiMultilingual website
Solutions: GeoIPGeographic Internet Protocol address locationGeolP Country - regularly updated database with information about IP addresses issued for those countries$country_code = apache_note(”GEOIP_COUNTRY_CODE”);$country_name = apache_note(GEOIP_COUNTRY_NAME);
Solution: CookiesUsed to retain the user preferences for country and language.In case the user will return several times, should not be forced to make the settings again and again.setcookie ("Country", $ country, 0,'/');setcookie ("Language", $ language, 0,'/');
Solution: .htaccessCan be used to rewrite URLsFirst case scenario: the visitor is automatically redirected in the related country's section, checked through the IP address of the user with content in the default country's languageSecond case scenario: the visitor is automatically redirected in the preffered country's section with content in the language choosen by him through cookies
.htaccess - First caseRewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^RO$RewriteCond %{REQUEST_URI} !^/index.php$RewriteCond %{HTTP_COOKIE} !^.*Language.*$ [NC]RewriteCond %{HTTP_COOKIE} !^.*Country.*$ [NC]RewriteRule ^(.*)$ /index.php?id=81&L=2 [L][NC] (no-case) - This makes the test case-insensitive - differences between 'A-Z' and 'a-z' are ignored when is match with the current URL.[L] (last rule) - Stop the rewriting process here and don't apply any more rewrite rules
.htaccess – First caseFirst condition: If the user is in Romania;The second condition: If the user has accessed www.ourdomain.com / index.php;The third condition: If the cookie Language isn't set;The fourth condition: If the cookie Country isn't set;Rewrite rule: If all the conditions are met, the user is redirected to that URL
.htaccess – Second caseRewriteCond %{REQUEST_URI} !^/index.php$ RewriteCond %{HTTP_COOKIE} Language=([^;]+) [NC]RewriteRule ^(.*)$ /index.php?L=%1 [NC,C]RewriteCond %{HTTP_COOKIE} Country=([^;]+) [NC]RewriteRule ^(.*)$ /index.php?id=%1%2 [NC,L,QSA][C] (chained with next rule) - Chains the current rule with the next rule. If a rule matches, then the rule is processed further, but if the rule does not match, then all the following chained rule will not be processed[QSA] (query string append) - Forces the rewriting engine to add a query string part of the existing string, instead of replacing it.
.htaccess – Second caseFirst condition: If the user has accessed www.ourdomain.com / index.php;The second condition: take the value of the cookie LanguageRewrite rule: rewrite based on our cookie valueThe third condition: take the value of the cookie CountryRewrite rule: rewrite based on the values of our cookies Country and Language
Proxy websitesCheck at the following links:With an IP in Poland: http://proxy.trash.pl/With an IP Germany: http://www.surf-proxy.de/With a USA IP: http://open-browser.com/There are many proxy websites (google-it)
Links/Referenceshttp://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz http://www.maxmind.com/app/mod_geoiphttp://www.askapache.com/htaccess/htaccess-fresh.html#modrewrite2http://corz.org/serv/tricks/htaccess2.phphttp://httpd.apache.org/docs/2.0/mod/mod_rewrite.html
EPOINTWeb Solutions SRL| VAT No RO 13120890|  Office: Str. Dornei No 3, 300393 TIMISOARA, ROMANIA|FAX +40 / 256 / 407 147Thankyou!

Multilanguage and Location Complexity in International Websites

  • 1.
    Multilanguage and LocationComplexity in International Websites
  • 2.
    The ChallengeProblem analysis The SolutionGeoIP, Cookies, .htaccess, Proxy websitesLinks/References
  • 3.
    The ChallengeContent sectionsof the website different for the available countries An user from Germany will enter in the German section of the website with content in German languageIf the user from Germany prefer the content from the UK section and Polski language, on his return he will enter directly on the UK section of the website with content in PolskiMultilingual website
  • 4.
    Solutions: GeoIPGeographic InternetProtocol address locationGeolP Country - regularly updated database with information about IP addresses issued for those countries$country_code = apache_note(”GEOIP_COUNTRY_CODE”);$country_name = apache_note(GEOIP_COUNTRY_NAME);
  • 5.
    Solution: CookiesUsed toretain the user preferences for country and language.In case the user will return several times, should not be forced to make the settings again and again.setcookie ("Country", $ country, 0,'/');setcookie ("Language", $ language, 0,'/');
  • 6.
    Solution: .htaccessCan beused to rewrite URLsFirst case scenario: the visitor is automatically redirected in the related country's section, checked through the IP address of the user with content in the default country's languageSecond case scenario: the visitor is automatically redirected in the preffered country's section with content in the language choosen by him through cookies
  • 7.
    .htaccess - FirstcaseRewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^RO$RewriteCond %{REQUEST_URI} !^/index.php$RewriteCond %{HTTP_COOKIE} !^.*Language.*$ [NC]RewriteCond %{HTTP_COOKIE} !^.*Country.*$ [NC]RewriteRule ^(.*)$ /index.php?id=81&L=2 [L][NC] (no-case) - This makes the test case-insensitive - differences between 'A-Z' and 'a-z' are ignored when is match with the current URL.[L] (last rule) - Stop the rewriting process here and don't apply any more rewrite rules
  • 8.
    .htaccess – FirstcaseFirst condition: If the user is in Romania;The second condition: If the user has accessed www.ourdomain.com / index.php;The third condition: If the cookie Language isn't set;The fourth condition: If the cookie Country isn't set;Rewrite rule: If all the conditions are met, the user is redirected to that URL
  • 9.
    .htaccess – SecondcaseRewriteCond %{REQUEST_URI} !^/index.php$ RewriteCond %{HTTP_COOKIE} Language=([^;]+) [NC]RewriteRule ^(.*)$ /index.php?L=%1 [NC,C]RewriteCond %{HTTP_COOKIE} Country=([^;]+) [NC]RewriteRule ^(.*)$ /index.php?id=%1%2 [NC,L,QSA][C] (chained with next rule) - Chains the current rule with the next rule. If a rule matches, then the rule is processed further, but if the rule does not match, then all the following chained rule will not be processed[QSA] (query string append) - Forces the rewriting engine to add a query string part of the existing string, instead of replacing it.
  • 10.
    .htaccess – SecondcaseFirst condition: If the user has accessed www.ourdomain.com / index.php;The second condition: take the value of the cookie LanguageRewrite rule: rewrite based on our cookie valueThe third condition: take the value of the cookie CountryRewrite rule: rewrite based on the values of our cookies Country and Language
  • 11.
    Proxy websitesCheck atthe following links:With an IP in Poland: http://proxy.trash.pl/With an IP Germany: http://www.surf-proxy.de/With a USA IP: http://open-browser.com/There are many proxy websites (google-it)
  • 12.
  • 13.
    EPOINTWeb Solutions SRL|VAT No RO 13120890| Office: Str. Dornei No 3, 300393 TIMISOARA, ROMANIA|FAX +40 / 256 / 407 147Thankyou!