|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
I'm not sure if this falls under content negotiation or rule rewriting or both. What I want to do is find out what language they want using content negotiation and then redirect them to my script sending the language as a variable.
Instead of using a bunch of files called index.html.fr, index.html.en, index.html.de I'll use a script like this so that index.html.en becomes index.php?lang=en index.html.fr becomes index.php?lang=fr index.html.de becomes index.php?lang=de etc., etc., etc. I imagine you could use the HTTP_ACCEPT_LANGUAGE server variable for the rewriting of the rule, but I haven't found enough documentation to tell me how to do that. An example would be nice. Thanks nemo |
|
#2
|
||||
|
||||
|
Passing the language to a php script is a good idea, example:
/* "Virtual" Page */ /articles/xxx/yy.html (note about yy: 'en' for english 'it' for italiano ) could be internal redirected to /* "Physical" page */ /pages/articles/show.php?lang=yy&id=xxx I put these rules inside my httpd.conf, my web host will let me modify it :-)). ####short example of internal redirection RewriteEngine on RewriteRule ^/articles/([^/]+)/(en|it).html$ /pages/articles/show.php?lang=$2&id=$1 [T=application/x-httpd-php,L] ####customize the rules for your needs ([^/]+), can be customized to fit your needs (only numbers, etc) This is a simple example that could give you some ideas, depending of what you want to do and the tools that you have. More infos about rewrite here: http://httpd.apache.org/docs/mod/mod_rewrite.html also if you do a search inside this forum you could found many threads about rewrite...they helped me a lot :-) |
![]() |
| Viewing: Dev Shed Forums > System Administration > Apache Development > rewriting URLs by language |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|