3. The Challenge Content 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 language If 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 Polski Multilingual website
4. Solutions: GeoIP Geographic Internet Protocol address location GeolP 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: Cookies Used 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,'/');
6. Solution: .htaccess Can be used to rewrite URLs First 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 language Second 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 - First case RewriteCond %{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 – First case First 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 – Second case RewriteCond %{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 – Second case First condition: If the user has accessed www.ourdomain.com / index.php; The second condition: take the value of the cookie Language Rewrite rule: rewrite based on our cookie value The third condition: take the value of the cookie Country Rewrite rule: rewrite based on the values of our cookies Country and Language
11. Proxy websites Check 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)