开发者

Any Ideas for Developing a Multi Language Site - SEO, php, mysql

I have just finished a client’s website and now they want to have different languages.

At the moment the sites content is stored on tables in a MySQL db:

  • pages: seotitle, seodesc, smallHtml, fullHtml

  • products: ID, seotitle, seodesc, smallHtml, fullHtml

I was thinking a good way to do it would be to have an extra table:

  • languages: ID, LanguageCode, language

Then modify the pages and products table to:

  • pages: slug, seotitle, seodesc, smallHtml, fullHtml, languageCode
  • products: ID, slug, seotitle, seodesc, smallHtml, fullHtml, languageCode

So I would be using a query like

SELECT * FROM pages WHERE slug = '$slug' AND language='$language'

Should I set $language as a cookie or session?

Also, I am stuck on what to do as far as SEO goes. At the moment the site URL structure is /pages.php?slug=page-slug. This gets rewritten by mod_rewrite to /pages/page-slug.

So I was thinking of having /pages.php?slug=开发者_开发百科page-slug&code=languagecode rewriting to /pages/page-slug/languagecode. Same for products.

Would this be a good method or can you see it failing somehow?

If anyone has any better methods or links to resources I may have missed that would be much appreciated.

Thanks for reading.

EDIT/////

If I was to use this method http://en.kioskea.net/faq/596-change-the-language-of-your-website and change the language behind the scenes, without changing the URL structure how would Google handle this?


Google and other search engines don’t try to guess the language by inspecting the URL, it’s the content that matters:

Google uses the content of the page to determine its language, but the URL itself provides human users with useful clues about the page’s content.

This is why you should declare the content’s language properly: In HTTP use Content-Language to specify the document’s default language and use the lang attribute for language changed within the document.

Having a multilingual web site you should also consider doing some kind language negotiation (see also my answer to Detect Browser Language in PHP); but also take the nuances into account that are associated with it (see Common HTTP Implementation Problems).

But yet, choosing an appropriate URI structure is also important – even if only for the users. That means the URI should reflect the chosen language (unless you want to provide a language-independent entry point for language negotiation).

But what URI design you choose is up to you. Do it from the user’s perspective.


Basics, each table should have an ID, looks like Pages would be missing it if you changed it as proposed.

Many major websites (including Wikipedia) have the language prefixed as a subdomain using the 2 digit ISO abbreviation for languages, e.g. English = en, etc. Which would make your URLs look similar to en.websitename.com. Bear in mind though that most multi-language websites don't have the default language shown in the URL, so if English is your default then English would be www.websitename.com but the French would be fr.websitename.com. This seems to be a commonly accepted approach, and also helps the URLs look cleaner when viewing subpages. Your other page URL structure looks SEO friendly apart from the language bit.

You'll need to think about how a visitor is first going to enter your domain, whether to your main homepage or to a subpage (via search engines mostly). With that you should then try and redirect the user to the language from there web browser (see here for a good way to do this). Although it's also a good idea if the content the user (on there first visit) was going to is different to the language of there browser then it's good for usability to offer a clear way to access both versions, which you would then remember via a cookie/session.

Other SEO tips: see here for the basics.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜