mercredi 29 avril 2015

Words in different languages in the url

I have a website in 3 languages. I only have one page with the code and I change the text for each language.

Just a simplified example of the same page in English and French:

http://ift.tt/1bUhYyr
myDomain/tap.php/?lang=fr

To clean the url I use:

RewriteRule (myDomain)\/(\w{2})\/(.*) $1\/$3.php?lang=$2

This redirects the pages from:

myDomain/en/tap
myDomain/fr/tap

This works well but my question is: Is it possible to have words in different languages in the url? For instance, if some user writes in French:

myDomain/fr/robinet

Note: "robinet" is "tap" in French

could it be redirected to:

myDomain/tap.php/?lang=fr

(Remember that I just have 1 page for both languages, so myDomain/fr/robinet.php/lang=fr does not exist. I could make another redirect from that last to myDomain/fr/tap.php/?lang=fr but it doesn't seem like a very efficient solution) Maybe the solution is not in the .htaccess?

So my question is: how do you use words in different languages in the url?

Aucun commentaire:

Enregistrer un commentaire