Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Url format for internationalized web app?

Scenario

The web server gets a request for http://domain.com/folder/page. The Accept-Language header tells us the user prefers Greek, with the language code el. That's good, since we have a Greek version of page.

Now we could do one of the following with the URL:

  1. Return a Greek version keeping the current URL: http://domain.com/folder/page
  2. Redirect to http://domain.com/folder/page/el
  3. Redirect to http://domain.com/el/folder/page
  4. Redirect to http://el.domain.com/folder/page
  5. Redirect to http://domain.com/folder/page?hl=el
  6. ...other alternatives?

Which one is best? Pros, cons from a user perspective? developer perspective?

like image 998
Arne Evertsson Avatar asked Aug 22 '09 12:08

Arne Evertsson


2 Answers

I would not go for option 1, if your pages are publically available, i.e. you are not required to log in to view the pages. The reason is that a search engine will not scan the different language versions of the page. The same reason goes agains option no 5. A search engine is less likely to identify two pages as separate pages, if the language identification goes in the query string.

Lets look at option 4, placing the language in the host name. I would use that option if the different language versions of the site contains completely different content. On a site like Wikipedia for example, the Greek version contains its own complete set of articles, and the English version contains another set of articles.

So if you don't have completely different content (which it doesn't seem like from your post), you are left with option 2 or 3. I don't know if there are any compelling arguments for one over the other, but no. 3 looks nicer in my eyes. So that is what I would use.

But just a comment for inspiration. I'm currently working on a web application that has 3 major parts, one public, and two parts for two different user types. I have chosen the following url scheme (with en referring to language of course):

http://www.example.com/en/x/y/z for the public part.
http://www.example.com/part1/en/x/y/z for the one private part
http://www.example.com/part2/en/x/y/z for the other private part.

The reason for this is that if I were to split the three parts up into separate applications, it will be a simple reconfiguration in the web server when I have the name of the part at the top of the path. E.g. if we were to use a commercial CMS system for the public part of the site

Edit: Another argument against option no. 1 is that if you ONLY listen to accept-language, you are not giving the user a choice. The user may not know how to change the language set up in a browser, or may be using a frinds computer setup to a different language. You should at least give the user a choice (storing it in a cookie or the user's profile)

like image 65
Pete Avatar answered Dec 04 '22 23:12

Pete


I'd choose number 3, redirect to http://example.com/el/folder/page, because:

  1. Language selection is more important than a page selection, thus selected language should go first in a true human-readable URL.
  2. Only one domain gets all Google's PR. That's good for SEO.
  3. You could advert your site locally with a language code built-in. E.g. in Greece you would advert as http://example.com/el/, so every local visitor will get to a site in Greece and would avoid language-choosing frustration.

Alternatively, you can go for number 5: it is fine for Google and friends, but not as nice for a user.

Also, we should refrain to redirect a user anywhere, unless required. Thus, in my mind, a user opening http://example.com/folder/page should get not a redirect, but a page in a default language.

like image 42
sanmai Avatar answered Dec 04 '22 23:12

sanmai