Jump to content

Domain redirect (language dependent) help!


kinaski

Recommended Posts

Hello to all!

 

I'm trying to setup my new php site, which is bilingual (english/french) in a way that each of the separate language versions use different domains (which I already have - two domains and one install of the site).

 

Right now my site is functioning with manual language switching.

 

Thou I'm not good enough with php I suppose that the language versions are maintained on the session level (but I'm not s sure). Anyway I got something like this when I select the language drop down: .mysite.com/index.php?lang=english for english and .mysite.com/index.php?lang=french for french version.

 

What I want to do is apply some kind of apache/php redirects in my site so that when users select english domain(www.mysite.com) the english language is automatically selected, and when they go to the french domain(www.monsite.com) to switch to french version.

 

How can I do this?

 

I got this response from other forum:

 

if(FALSE !== strpos($_SERVER['HTTP_HOST'], 'www.mysite.com')) {
    // do french stuff
} else {
    // do english stuff
}

But the guy wasn't available for me to explain me this code, so I can't really make it work :(

 

I would be very very thankful if someone out there point me to the right direction.

 

Thank you in advance.

Link to comment
https://forums.phpfreaks.com/topic/95474-domain-redirect-language-dependent-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.