Domain redirect (language dependent) help!

Discussion in 'PHP' started by Kinaski, Mar 9, 2008.

  1. #1
    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. So I got something like this: .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.

    Is this possible??

    Thank you in advance!
     
    Kinaski, Mar 9, 2008 IP
  2. 00johnny

    00johnny Peon

    Messages:
    149
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    yeah its totally possible.
    You would point the domains to the same place
    Then check the domain in php:
    
    if(FALSE !== strpos($_SERVER['HTTP_HOST'], 'www.mysite.com')) { // note extra =
        // do french stuff
    } else {
        // eat freedom fries
    }
    
    PHP:
    and if its your french version change the language on the page accordingly, this way you have no messy session level or other crazy vars to check
     
    00johnny, Mar 10, 2008 IP
  3. Ares

    Ares Member

    Messages:
    47
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    45
    #3
    if you can give me the code that set's session for language , I can give you the code .
    ofcourse the above post will solve your problem if you have a little knowledge of php ! [​IMG]
     
    Ares, Mar 10, 2008 IP
  4. Kinaski

    Kinaski Peon

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thanks a lot for the reply, but being a total php looser myself, it would be very helpfull if I know the replacement for the french and freedom fries :)

    I just realize that my site uses joomla 1.0.13 for CMS and I guess that the extension dealing with the language settings is joomfish. So my site uses a very strange mix on french/freedom fries with german sausages :)

    Thanks, and I would appreciate some further help on this.
     
    Kinaski, Mar 10, 2008 IP
  5. Kinaski

    Kinaski Peon

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Hi Ares, thanks for the reply. I got no idea what's the code that is setting the language, but I just found that the site uses a joomla 1.0.13 as CMS and joomfish extension. I hope that this would help??

    Thank you again.
     
    Kinaski, Mar 10, 2008 IP
  6. Kinaski

    Kinaski Peon

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Hi,

    I just tried the above code, in the main index.php file and in my template index.php file and I can't make it work :(

    Please guys, anyone can give a help on this??

    Thanks!
     
    Kinaski, Mar 10, 2008 IP