jannezz Posted December 20, 2007 Posted December 20, 2007 Hi all, I'm trying to link the language on the domainname. I've got a .nl and a .com domainname. I want it to be that if you enter website via the .com the language will be english for the rest of the visit, and if you visit the .nl domainname at first the language must be - and stay - dutch. The whole shop runs within the .nl domainname. So if you enter the .com version, you're next link will lead to the .nl/* version. Kind regards,
♥FWR Media Posted December 20, 2007 Posted December 20, 2007 Hi all, I'm trying to link the language on the domainname. I've got a .nl and a .com domainname. I want it to be that if you enter website via the .com the language will be english for the rest of the visit, and if you visit the .nl domainname at first the language must be - and stay - dutch. The whole shop runs within the .nl domainname. So if you enter the .com version, you're next link will lead to the .nl/* version. Kind regards, I'm crap at this so try at your own risk :blink: in .htaccess try .. RewriteCond %{HTTP_HOST} !^www\.mysite\.com [NC] RewriteCond %{HTTP_HOST} !^$ RewriteRule ^(.*) http://www.mysite.nl/index.php?language=en/$1 I don't hold out much hope tbh but give it a go. Obviously changing the mysite Ultimate SEO Urls 5 PRO - Multi Language Modern, Powerful SEO Urls KissMT Dynamic SEO Meta & Canonical Header Tags KissER Error Handling and Debugging KissIT Image Thumbnailer Security Pro - Querystring protection against hackers ( a KISS contribution ) If you found my post useful please click the "Like This" button to the right. Please only PM me for paid work.
jannezz Posted December 21, 2007 Author Posted December 21, 2007 I'd love to try it out, but there is no hosting on the .com domainname, it's just redirectied to the .nl
jannezz Posted December 21, 2007 Author Posted December 21, 2007 And yes i can check wether the user entered the website using the .com or .nl extension. This is some code from the application_top.php $domein_ext = explode (".", $_SERVER['HTTP_HOST']); if ($domein_ext[2] == "nl") { $language_code= "dutch"; $language_id = "4"; } else { $language_code= "english"; $language_id = "1"; } $lng->set_language($language_code); But is still will not work, The session isn't set right... What to do with this part : tep_session_register('language'); tep_session_register('languages_id');
♥FWR Media Posted December 27, 2007 Posted December 27, 2007 Try near the very top of application_top.php $domein_ext = explode (".", $_SERVER['HTTP_HOST']); if (!isset($HTTP_GET_VARS['language'])) // Make sure the user has not requested a language if ($domein_ext[2] == "com") { $HTTP_GET_VARS['language'] = 'en'; } Ultimate SEO Urls 5 PRO - Multi Language Modern, Powerful SEO Urls KissMT Dynamic SEO Meta & Canonical Header Tags KissER Error Handling and Debugging KissIT Image Thumbnailer Security Pro - Querystring protection against hackers ( a KISS contribution ) If you found my post useful please click the "Like This" button to the right. Please only PM me for paid work.
jannezz Posted December 27, 2007 Author Posted December 27, 2007 That works fine for selecting the right language when entering the store on .com or .nl But as soon as you click - and entered by a .com domain - you will be directed to the .nl version of the website, with dutch spelling. So the sessions need to be set right ... How to do that ?
♥FWR Media Posted December 27, 2007 Posted December 27, 2007 Ok I'm finding this a bit tough as I can't test but try this .. In application_top.php find .. // set the language Add directly ABOVE if (!isset($HTTP_GET_VARS['language'])) { // Make sure the user has not requested a language $domein_ext = explode (".", $_SERVER['HTTP_HOST']); if ($domein_ext[2] == "com") { $HTTP_GET_VARS['language'] = 'en'; $_SESSION['show_english'] = 'on'; }elseif ( (isset($_SESSION['show_english'])) && ($_SESSION['show_english'] == 'on') ) { $HTTP_GET_VARS['language'] = 'en'; unset($_SESSION['show_english']); } } Ultimate SEO Urls 5 PRO - Multi Language Modern, Powerful SEO Urls KissMT Dynamic SEO Meta & Canonical Header Tags KissER Error Handling and Debugging KissIT Image Thumbnailer Security Pro - Querystring protection against hackers ( a KISS contribution ) If you found my post useful please click the "Like This" button to the right. Please only PM me for paid work.
jannezz Posted December 27, 2007 Author Posted December 27, 2007 I've adjusted the code above and now it's working fine ! if (!isset($HTTP_GET_VARS['language'])) { // Make sure the user has not requested a language if (isset($_SERVER['HTTP_REFERER'])) { $domein_ext = explode (".", $_SERVER['HTTP_REFERER']); } else { $domein_ext = explode (".", $_SERVER['HTTP_HOST']); } if (!tep_session_is_registered('language')) { if ($domein_ext[2] == "nl" || $domein_ext[2] == "nl/") { $HTTP_GET_VARS['language'] = 'nl'; } else { $HTTP_GET_VARS['language'] = 'en'; } } }
♥FWR Media Posted December 27, 2007 Posted December 27, 2007 Another method may be .. In application_top.php find .. // set the language Add directly ABOVE if (!isset($HTTP_GET_VARS['language'])) { // Make sure the user has not requested a language $domein_ext = explode (".", $_SERVER['HTTP_HOST']); if ($domein_ext[2] == "com") { $HTTP_GET_VARS['language'] = 'en'; }elseif ($_SERVER['HTTP_REFERER'] == 'mycomdomain.com') ) { // Change mycomdomain.com $HTTP_GET_VARS['language'] = 'en'; } } Ultimate SEO Urls 5 PRO - Multi Language Modern, Powerful SEO Urls KissMT Dynamic SEO Meta & Canonical Header Tags KissER Error Handling and Debugging KissIT Image Thumbnailer Security Pro - Querystring protection against hackers ( a KISS contribution ) If you found my post useful please click the "Like This" button to the right. Please only PM me for paid work.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.