When I set up a site in multiple languages, how should I set up my URLs for search engines and usability?Let's say my site is www.example.com, and I'm translating into French and Spanish. What is best for usability and SEO?Directory option:http://www.example.com/sample.htmlhttp://www.example.com/fr/sample.htmlhttp://www.example.com/es/sample.htmlSubdomain option:http://www.example.com/sample.htmlhttp://fr.example.com/sample.htmlhttp://es.example.com/sample.htmlFilename option:http://www.example.com/sample.htmlhttp://www.example.com/sample.fr.htmlhttp://www.example.com/sample.es.htmlAccept-Language header:Or should I simply parse the Accept-Language header and generate content server-side to suit that header?Is there another way to do this? If the different language versions don't have different urls, what do I do about the search engines?UPDATE 2011-12-06Google has new recommendations for meta tags for explicitly pointing to other language content: New markup for multilingual content.UPDATE 2012-05-25Related but not precisely: Multilingual and multinational site annotations in SitemapsUPDATE 2013-06-12Targeting site content to a specific country includes discussion of several URL schemes directly relevant to the question.
How should I structure my URLs for both SEO and localization?
seo;url;language;multilingual;internationalization
There are many acceptable ways to structure your site for both SEO and internationalization.  Each have advantages and disadvantages.Top Level DomainsBuy the same domain name at multiple top level country domains like example.com, example.es and example.de.AdvantagesFully supported by Google.  You can add the sites to Google Webmaster Tools where there are options to tell Google about how they are targeted.Often preferred by users who tend to like content published on the TLD for their countryThe domain name itself can be localized.  Many international users may react badly to English words or an English sounding domain name.  This can be especially important for languages that do not use a Latin alphabet.Supports localization by country.  You can have separate sites like example.co.uk and example.com.au targeted at audiences in different countries.  The sites may have duplicate content with slight spelling differences and still rank well.  In fact, multiple well localized sites in the same language may rank better than a single site in that language.Hosting can be localized by pointing DNS to a web server in the country being targeted.DisadvantagesExpensive and time consuming to buy many domains. Especially if you have to deal with squatters.   Cookies cannot be shared across multiple locales, meaning that users have to log in separately to each site.No good option for localizing only by language since many languages have multiple countries and no country TLD may be the language code.  Even in cases where the TLD does match the language code like es, search engines may assume that the site is only appropriate for users from Spain, not for all Spanish speakers.Sub-domainsBuy a single domain, and use sub-domains such as en.example.com, and es.example.comAdvantagesFully supported by Google.Supports localization by country or by language.Hosting can be localized by pointing DNS to a web server located close to users.Easy and cheap to implement compared to buying multiple domains.Cookies can be shared across all locales, enabling single sign on for a more seamless user experience.DisadvantagesNo opportunity to localize the domain name itselfMay look less local to users compared to a top level domain.Sub-directoriesBuy a single domain, and use sub-directories such as example.com/en/, and example.com/es/Advantages and DisadvantagesThe same as sub-domains, except that there is one DNS entry which precludes hosting your site in multiple countries for different locales.Techniques that are NOT recommendedFile Names: Using different file names such as index_en.html and index_de.html.  This technique is not fully supported by Google.  For example, there is no way to set targeting in webmaster tools.URL Parameters: Using URL parameters such as lang=en.  It is not recommended for the same reason that different file names are not recommended.Accept Language Header: Automatically switching the language based on the Accept-Language header.Many users do not have this header set correctly.  This is especially true for users traveling abroad that may be using a friend's computer, or an internet cafe.  It is also often true for international users that install an English web browser and know enough English to be get around, but would prefer content in a different language.Google just announced that Googlebot will send the Accept-Language header and crawl from different geographic locations.  However, Google still recommends that you have separate URLs for content in different languages.You may use the Accept-Language header to suggest that users might prefer a different version of the site by displaying a message when the site they are visiting does not match the Accept-Language header.Geographic IP Addresses: Automatically switching the language based where the IP address is geographically located.Geo-ip databases are inaccurate.  Up to 10% of visitors may be assigned to the incorrect country.Some countries (like Canada) use more than one languageYou may use the IP address country to suggest a language or languages that a user may be interested in.On-page MarkupWhen supporting multiple languages, you should clearly mark up with language meta-data.Use the lang attribute in the html tag:<html lang=en>Use rel alternate links to the same page in other languages as suggested by Google:<link rel=alternate hreflang=es href=http://www.example.com/ /><link rel=alternate hreflang=es-ES href=http://es-es.example.com/ /><link rel=alternate hreflang=es-MX href=http://es-mx.example.com/ /> <link rel=alternate hreflang=en href=http://en.example.com/ />Alternately, this information can be put into sitemap files.Tell Google About Your SiteYou should add each language (or locale) of your site to Google Webmaster Tools.  This can be done for top level domains, for sub- domains, or for sub-directories.  If your site is targeted by country, you should use webmaster tools to set the site targeting.  Navigate to Configuration -> Settings -> Geographic target and choose to target the correct country from the drop down list.