Results 1 to 2 of 2

Thread: URL modification link

  1. #1
    Join Date
    Sep 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default URL modification link

    Hello,
    I would like to create a link on my page that simply changes the domain but not the actual path of site. I have an english and french site, so for example.

    The english button on the french page would make the user change from french.com/page to english.com/page. I would like the domain part to change but not the "path" part

    how can this be done

    thanks,
    Neil

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    <?php echo 'http://www.french.com'.$_SERVER['REQUEST_URI']; ?>

    If you don't know which domain you are currently on, you can use $_SERVER['HTTP_HOST'] to check. Then use if statements to decide which is the opposite (and should be the link).
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •