XFileSharing Pro - Redirection by Language with htaccess

Posts: 10
Joined: Aug 28, 2009 3:16 pm

Redirection by Language with htaccess

#1 Postby tommylee » Nov 25, 2009 6:06 am


I want to use htaccess file to redirect the user to correct site language according to user browser settings.

So instead of german users going and clicking german flag they should get the german language of my site.

I read a little bit and found that I should add something like below to htaccess file but is this correct, will it work also which htaccess file should I add this to?


Code: Select all

#The 'Accept-Language' header starts with 'de'
#and the test is case-insensitive ([NC])
RewriteCond %{HTTP:Accept-Language} ^de [NC]
#Redirect user to /?op=change_lang&lang=german address
#sending 301 (Moved Permanently) HTTP status code
RewriteRule ^$ /?op=change_lang&lang=german [L,R=301]

RewriteCond %{HTTP:Accept-Language} ^ru [NC]
RewriteRule ^$ /?op=change_lang&lang=russian [L,R=301]
#For every other language (including English) use English
RewriteRule ^$ /?op=change_lang&lang=english [L,R=301]
a small note I am using 1.5 if it makes any difference.

also is there really a major advantage to upgrade to 1.6, I see that there are some small problems people having so is it better to wait untill all solved?

Posts: 90
Joined: Nov 18, 2009 9:15 pm

#2 Postby Hendrickson » Nov 29, 2009 6:47 am

Hi this sounds interesting, does adding this code work? Will a German user with a browser in DE be presented with the German version of the site?

Posts: 10
Joined: Aug 28, 2009 3:16 pm

#3 Postby tommylee » Dec 09, 2009 12:40 pm

no sadly it does not work :(

I would really like to get some help on this if anyone knows a solution please :)

thank you...

Posts: 3
Joined: Jun 16, 2009 2:05 am

#4 Postby kadux » Dec 11, 2009 11:55 am

nice ideia, but don't work :(
anyone here have any solution ?