Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Oct 2008
    Thanked 2 Times in 2 Posts

    .htaccess - if redirect from xyz.net rewrite browser language to spanish

    Hello, I would like to rewrite the browser language in htaccess is it possible?


    there is the domain xyz.com and the language of the site is English;
    there is the domain xyz.net that redirects to xyz.com;

    If somebody enters xyz.com from a redirect of xyz.net and their browser language is English, I would like the htaccess to change/rewrite the browser language to Spanish.

    Is it possible?

    I'll have a plugin that translates to Spanish according to the browser language, but I want ALL users coming from xyz.net see the spanish version even if they have the browser in English.

  2. #2
    New Coder
    Join Date
    Jul 2011
    Thanked 13 Times in 13 Posts
    You could do this for the first hit to the site by checking the HTTP_REFERER, but as soon as they click around the site the referer would no longer be the .net address but the .com address. The only solution that springs to mind would be setting a cookie on the users machine if the refererer is the .com address and checking the cookie in your scripts. It is worth baring in mind though that there is new european legislation about the use of cookies, that could potentially make this a very dark grey area. The only other solution is to have some reference to the language stored in the url, such as using a different sub-domain etc.


Posting Permissions

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