This is a discussion on htaccess redirection on language within the Apache Web Server forums, part of the Web Server and Related Forums category; Hi, I'm using this .htaccess to redirect users based on browser language: RewriteEngine on RewriteCond %{HTTP:Accept-Language} (it) [...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi, I'm using this .htaccess to redirect users based on browser
language: RewriteEngine on RewriteCond %{HTTP:Accept-Language} (it) [NC] RewriteRule .* http://www.site.com/index-it.html [R,L] all italian browsers are directed to index-it.html but they are trapped on the home page, because if the surfer click on a link (for example http://www.site.com/documents/doc.html) he is always sent to http://www.site.com/index-it.html. In my intention all english and other languages traffic should flow to the standard http://www.site.com/index.html page. Can someone help me with this code or with some suggestion ? |
|
|||
|
"Pipp" <ddr2pw@yahoo.com> schreef in bericht
news:1169314719.318115.179180@51g2000cwl.googlegro ups.com... > all italian browsers are directed to index-it.html but they are trapped > on the home page, > because if the surfer click on a link (for example > http://www.site.com/documents/doc.html) > he is always sent to http://www.site.com/index-it.html. > > In my intention all english and other languages traffic should flow to > the standard http://www.site.com/index.html > page. > > Can someone help me with this code or with some suggestion ? In general a browser will, often to my dislike, choose my native language for me. I like to read documentation in the native language of the author -provided I am able to understand it-. Have a peak how apache -both their site and yours- is handling multi-language documentation: a visitor's choice overrides the browser's preferance. http://httpd.apache.org/docs/2.2/mod....html#typemaps At first sight I think it has good change of working in.htaccess too. The configuration -name and path varies per redistribution- has a section like <Directory "/usr/share/doc/apache2-doc/manual/"> Options Indexes AllowOverride None Order deny,allow Deny from all Allow from 127.0.0.0/255.0.0.0 ::1/128 <Files *.html> SetHandler type-map </Files> SetEnvIf Request_URI ^/manual/(de|en|es|fr|ja|ko|ru)/ prefer-language=$1 RedirectMatch 301 ^/manual(?:/(de|en|es|fr|ja|ko|ru)){2,}(/.*)?$ /manual/$1$2 </Directory> Each set of files ... :/usr/share/doc/apache2-doc/manual$ ls -1 bind.html bind.html.de bind.html.en bind.html.fr bind.html.ja.euc-jp bind.html.ko.euc-kr .... has a mapping :/usr/share/doc/apache2-doc/manual$cat bind.html URI: bind.html.de Content-Language: de Content-type: text/html; charset=ISO-8859-1 URI: bind.html.en Content-Language: en Content-type: text/html; charset=ISO-8859-1 URI: bind.html.fr Content-Language: fr Content-type: text/html; charset=ISO-8859-1 URI: bind.html.ja.euc-jp Content-Language: ja Content-type: text/html; charset=EUC-JP URI: bind.html.ko.euc-kr Content-Language: ko Content-type: text/html; charset=EUC-KR -- EoF HansH |
|
|||
|
Davide Bianchi ha scritto: > Browser-selection language is already done by Multiviews, why are > you reinventing the wheel (in a broken way)? > Just activate Multiviews and you're on. I'm not reinventing the wheel, I'm discovering it :) I'm not an apache expert, so, if someone as a direct example, tutorial, please point me to it. Thank you |