![]() |
|
#1
|
|||
|
|||
.htaccess language / rewrite problemI am trying to setup a .htaccess file to redirect users based on their language preference but for some reason the following will not work, it just redirects to german.com every time:
Code:
Could someone see if they can find an error in this file somewhere? This topic was asked on many boards but nobody posted code to show it working, so I have nothing to really go by. Any ideas would help. Thanks |
|
#2
|
||||
|
||||
|
Hello spinflip,
I think your logic is wrong... Basically your rewrite lines above work this way: IF the HTTP_ACCEPT_LANGUAGE string does NOT start with de THEN send them to the german version of the site. Clearly this is the opposite of what you wanted! Take off the ! (exclamation mark) in ALL your lines and the logic will be right.... I think AND use the flag [OR] when checking for at least ONE match instead of the default [AND] in your lines now... __________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#3
|
|||
|
|||
|
Thank you for your help but this still does not work:
Options +FollowSymLinks RewriteEngine On RewriteCond %{HTTP_ACCEPT_LANGUAGE} de-at [OR] RewriteCond %{HTTP_ACCEPT_LANGUAGE} de [OR] RewriteCond %{HTTP_ACCEPT_LANGUAGE} de-li [OR] RewriteCond %{HTTP_ACCEPT_LANGUAGE} de-lu [OR] RewriteCond %{HTTP_ACCEPT_LANGUAGE} de-ch RewriteRule ^.*$ www.german.com [L,R] RewriteCond %{HTTP_ACCEPT_LANGUAGE} es-ar [OR] RewriteCond %{HTTP_ACCEPT_LANGUAGE} es-bo [OR] RewriteCond %{HTTP_ACCEPT_LANGUAGE} es-cl [OR] RewriteCond %{HTTP_ACCEPT_LANGUAGE} es-co [OR] RewriteCond %{HTTP_ACCEPT_LANGUAGE} es-cr [OR] RewriteCond %{HTTP_ACCEPT_LANGUAGE} es-do [OR] RewriteCond %{HTTP_ACCEPT_LANGUAGE} es-ec [OR] RewriteCond %{HTTP_ACCEPT_LANGUAGE} es-sv [OR] RewriteCond %{HTTP_ACCEPT_LANGUAGE} es-gt [OR] RewriteCond %{HTTP_ACCEPT_LANGUAGE} es-hn [OR] RewriteCond %{HTTP_ACCEPT_LANGUAGE} es [OR] RewriteCond %{HTTP_ACCEPT_LANGUAGE} es-mx [OR] RewriteCond %{HTTP_ACCEPT_LANGUAGE} es-ni [OR] RewriteCond %{HTTP_ACCEPT_LANGUAGE} es-pa [OR] RewriteCond %{HTTP_ACCEPT_LANGUAGE} es-py [OR] RewriteCond %{HTTP_ACCEPT_LANGUAGE} es-pe [OR] RewriteCond %{HTTP_ACCEPT_LANGUAGE} es-pr [OR] RewriteCond %{HTTP_ACCEPT_LANGUAGE} es-us [OR] RewriteCond %{HTTP_ACCEPT_LANGUAGE} es-uy [OR] RewriteCond %{HTTP_ACCEPT_LANGUAGE} es-ve RewriteRule ^.*$ www.spanish.com [L,R] |
|
#4
|
||||
|
||||
Sample rewrite rules for your situation...Try something like this for starters, then if it works, you can experiment further:
Code:
__________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#5
|
|||
|
|||
|
I don't know why but it does not work. I am setting my language prefs in my browser to test, but I dont think that is the problem.
|
|
#6
|
||||
|
||||
|
You can quickly test your HTTP_ACCEPT_LANGUAGE by viewing a phpinfo file and looking for the value under Apache Environment.
If it's what you expected, then post the value you found since I am not too well versed with this particular variable and what it may contain. __________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
Recent GIDBlog
Meeting the local Iraqis by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| .htaccess on Windows2k, and the trailing slash | Pedster2k | Apache Web Server Forum | 6 | 24-Jan-2004 17:32 |
| unwanted scrollbar problem | kelly001 | Web Design Forum | 3 | 24-Oct-2003 10:44 |
| problem with creating class | mohammed | C++ Forum | 1 | 11-Oct-2003 09:04 |
| Problem with .htaccess | Zergus | Apache Web Server Forum | 7 | 29-Jul-2003 11:01 |
| How I sorted my website compression problem | jrobbio | MySQL / PHP Forum | 0 | 05-Mar-2003 20:41 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The