1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Development PHP : Detect URL and pass to section on site.

Discussion in 'Software' started by :: Phat ::, 21 Jul 2006.

  1. :: Phat ::

    :: Phat :: Oooh shakalaka!

    Joined:
    7 Jun 2002
    Posts:
    4,886
    Likes Received:
    3
    Right,

    I have a customer who has two domains, but to keep things simple we're going to be hosting the site on one server space. (Its just the english/welsh version of the domain.)

    What I'd like is for the english domain name to point to index.php which would be the default language of the page. But for the welsh version of the domain to point to index.php?lang=cy (no I don't want to use redirect account on the server)
     
  2. DougEdey

    DougEdey I pwn all your storage

    Joined:
    5 Jul 2005
    Posts:
    13,933
    Likes Received:
    33
    Easy:

    Code:
    <?php 
    // get referrer from _SERVER array
    $ref = $_SERVER["HTTP_REFERER"];
    
    // look for bad guys!
    if ($ref == 'http://welshurl') 
    { 
        //reload with lang=cy
        //and any other stuff
    } 
    else
    {
        // load en site
    }
    ?>
     
  3. Ben

    Ben New Member

    Joined:
    11 Aug 2003
    Posts:
    1,000
    Likes Received:
    0
    Don't do that :p , there could be some one like me that dose not send referer info. Il post something up in a bit if it works.
     
    Last edited: 21 Jul 2006

Share This Page