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
    New to the CF scene
    Join Date
    Nov 2011
    Thanked 0 Times in 0 Posts

    htaccess redirect dual language browsers


    Im trying to redirect all users but swedish ones to the english side of my site but since swedish browsers by default have both english and swedish languages installed tey all get redirected to the english side.

    Swedish : xyz.com
    English : xyz.com/?lang=en

    Ive been using this code

    RewriteEngine on
    RewriteCond %{QUERY_STRING} !(&|^)lang=
    RewriteCond %{HTTP:Accept-Language} (aa|ab|af|am|ar|as|ay|az|ba|be|bg|bh|bi|bn|bo|br|ca|co|cs|cy|da|de|dz|el|en|eo|es|et|eu|fa|fi|fj|fo| fr|fy|ga|gd|gl|gn|gu|ha|hi|hr|hu|hy|ia|ie|ik|in|is|it|iw|ja|ji|jw|ka|kk|kl|km|kn|ko|ks|ku|ky|la|ln|l o|lt|lv|mg|mi|mk|ml|mn|mo|mr|ms|mt|my|na|ne|nl|no|oc|om|or|pa|pl|ps|pt|qu|rm|rn|ro|ru|rw|sa|sd|sg|sh |si|sk|sl|sm|sn|so|sq|sr|ss|st|su|sw|ta|te|tg|th|ti|tk|tl|tn|to|tr|ts|tt|tw|uk|ur|uz|vi|vo|wo|xh|yo| zh|zu) [NC]
    RewriteRule ^(.*)$ http://www.xyz.com/$1?lang=%1 [L]

    How can I do this so every browser is redirected to xyz.com/?lang=en but with an exception for swedish that would stay on xyz.com ?

    Greatful for any help !

  2. #2
    New Coder
    Join Date
    Jul 2011
    Thanked 13 Times in 13 Posts
    I've never tried anything like this but can't you just apply the opposite logic to what you have, i.e. if not accept language swedish redirect.


Posting Permissions

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