任何开发多语言网站的想法 - SEO,php,mysql [英] Any Ideas for Developing a Multi Language Site - SEO, php, mysql

查看:225
本文介绍了任何开发多语言网站的想法 - SEO,php,mysql的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚完成了一个客户端的网站,现在他们想要有不同的语言。



目前,网站内容存储在MySQL数据库的表上: / p>


  • 页面 seotitle seodesc smallHtml fullHtml


  • / em>,seotitle seodesc smallHtml fullHtml




我在想一个很好的方式来做一个额外的表:




  • 语言 ID LanguageCode 语言



    • 然后将页面和产品表修改为:




      • em>: ,seotitle , seodesc smallHtml , , seotitle seodesc smallHtml languageCode



      所以我会使用像

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

      我应该将$ code> $ language 设为Cookie还是会话?



      此外,我坚持在SEO去做什么。目前网址的结构是 /pages.php?slug=page-slug 。这被mod_rewrite改写为 / pages / page-slug



      所以我在想$ c> /pages.php?slug=page-slug&code=languagecode 重写为 / pages / page-slug / languagecode 。相同的产品。



      这是一个很好的方法,或者你会看到它失败了吗?



      如果有人有更好的方法或资源链接我可能会错过,将不胜感激。



      感谢阅读。



      EDIT /////



      如果我使用这种方法 http://en.kioskea.net/faq/596-change-the-language-of-your-website 并更改语言背后幕后,Google不会改变网址结构呢?

      解决方案

      基础知识,每张表都应该有ID,如果您按照建议更改,页面将会丢失。



      许多主要网站(包括维基百科)都将语言作为子域使用2位数ISO语言的缩写,例如英文= en等。这将使您的网址看起来类似于 en.websitename.com 。请记住,大多数多语言网站没有URL中显示的默认语言,所以如果英语是默认的,那么英语将是www.websitename.com ,但法语将是 fr.websitename.com 。这似乎是一种普遍接受的方法,也可以帮助URL在查看子页面时看起来更干净。您的其他网页网址结构看起来比SEO友善,除了语言位置。



      您需要考虑访客如何首先进入您的域名,无论是您的主页或主页(通过搜索引擎)。然后,您应该尝试通过网络浏览器将用户重定向到语言(请参阅此处

      其他SEO提示:请参阅这里的基础知识。


      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?

      解决方案

      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.

      这篇关于任何开发多语言网站的想法 - SEO,php,mysql的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆