This is a discussion on Language Redirect within the Apache Web Server forums, part of the Web Server and Related Forums category; Hiyas, I guess you all know the Apache2 Documentation: http://httpd.apache.org/docs-2.0/ They handle their displayed ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hiyas,
I guess you all know the Apache2 Documentation: http://httpd.apache.org/docs-2.0/ They handle their displayed language with type-maps as you can also choose another language via a link. I tried it on my homeserver and its working fine, but I also want to have it on a website that I'm having at hosteurope.de. So as I don't have access to the httpd.conf I'm trying to get it work with .htaccess and its an Apache 1.3 so this is what I got now: *code* AddHandler type-map var AddLanguage en .en AddLanguage de .de LanguagePriority en de <Files *.var> SetHandler type-map </Files> SetEnvIf Request_URI ^/manual/(de|en)/ prefer-language=$1 Redirect 301 /manual/de http://www.bsc-truchtelfingen.de/manual Redirect 301 /manual/en http://www.bsc-truchtelfingen.de/manual *code* So this is working as far as the type-maps go, but clicking a link doesn't change anything (language). It must be something with the SetEnvIf but I can't get it working. Here the orginal code apache.org is using: *code* AliasMatch ^/manual(?:/(?:de|en|es|fr|ja|ko|ru))?(/.*)?$ "C:/Programme/Apache Group/Apache2/manual$1" <Directory "C:/Programme/Apache Group/Apache2/manual"> Options Indexes AllowOverride None Order allow,deny Allow from all <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> *code* Thx Alex |
|
|||
|
Alexander Scheurer wrote: > > SetEnvIf Request_URI ^/manual/(de|en)/ prefer-language=$1 > Redirect 301 /manual/de http://www.bsc-truchtelfingen.de/manual > Redirect 301 /manual/en http://www.bsc-truchtelfingen.de/manual That won't work because the environment variable set by SetEnvIf is lost when doing a Redirect. That is why the original version uses Alias, where the translation is internal and the environment variable is retained. If you have access to mod_rewrite, you can try RewriteRule. Otherwise, I think you are out of luck. Joshua. |
|
|||
|
Alexander Scheurer wrote:
[snip] > SetEnvIf Request_URI ^/manual/(de|en)/ prefer-language=$1 > Redirect 301 /manual/de http://www.bsc-truchtelfingen.de/manual > Redirect 301 /manual/en http://www.bsc-truchtelfingen.de/manual > *code* > > So this is working as far as the type-maps go, but clicking a link > doesn't change anything (language). It must be something with the This is probably stupid, but should not the second 301 be truchtelfingen.EN ? I am a beginner but if you are as lazy a typist as I am you copied and pasted the actual code. (it sure looks wrong to me) HTH TK who often can not see the forest for the trees. ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups ----= East and West-Coast Server Farms - Total Privacy via Encryption =---- |