Bilingual site with parked domain

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jacotheron
    New Member
    • Jan 2008
    • 44

    Bilingual site with parked domain

    I have a problem again. I have a 2 sites for one of my customers. The site is English and Afrikaans. The English site is parked on the Afrikaans site.

    The script should check to see if the page is accessed through the correct domain. If it is not accessed through the correct domain, it should redirect to the correct domain and create a cookie to always return to the correct domain.

    Here is an example:

    Someone enters the site through english.co.za but it shows the afrikaans.co.za 's home page (afrikaans.co.z a/index.html). The script should see that it is the wrong page and redirect to the page english.com/en/index.html. The cookie should remember where to go if the user enters the site again (english.co.za or afrikaans.co.za )

    Can someone tell me how I am supposed to do this.
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Why should it show the Afrikaans home page when accessing through the English domain?

    Comment

    • Jacotheron
      New Member
      • Jan 2008
      • 44

      #3
      Originally posted by acoder
      Why should it show the Afrikaans home page when accessing through the English domain?
      The English domain is parked on the Afrikaans domain. Paked domain: "Parked Domain
      A Parked domain refers to a domain name that points to the same website as the domain name on which it is 'parked'. For example, you can park 'domainname.co. za' on the domain name 'domainname.com '. If someone types the parked domain name 'domainname.co. za' into a web browser, it will point to the same website that 'domainname.com ' points to.

      The web browser's address bar will display the parked domain name and will not display the domain name on which it is parked. A Parked domain name has the same IP address as the domain name on which it is parked."



      The problem is that the main home page is Arikaans in stead of English, but my client do not want the main home page English. The cookie and javascript should redirect viewers to the page according to the addressbar.

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Thanks for the clarification. In your code, check the location.href. If it's the English domain, redirect by setting window.location .href to the new URL.

        As for setting the cookies, I assume you know how to get/set cookies. First, check that the cookie exists. If it does, redirect. If it doesn't and it matches the English domain name, set the cookie and then redirect.

        Comment

        • Jacotheron
          New Member
          • Jan 2008
          • 44

          #5
          Originally posted by acoder
          Thanks for the clarification. In your code, check the location.href. If it's the English domain, redirect by setting window.location .href to the new URL.

          As for setting the cookies, I assume you know how to get/set cookies. First, check that the cookie exists. If it does, redirect. If it doesn't and it matches the English domain name, set the cookie and then redirect.
          Thank you, I will try this and I guess it should work.
          I just do not quite know how to get/set cookies but will try to create the correct cookies with the programs I use.

          Comment

          • acoder
            Recognized Expert MVP
            • Nov 2006
            • 16032

            #6
            Originally posted by Jacotheron
            I just do not quite know how to get/set cookies...
            This link should help.

            Comment

            Working...