开发者

How to build multilingual seo friendly urls in Rails 3?

开发者 https://www.devze.com 2023-03-22 04:21 出处:网络
I already a have a completely internationalize website already with content in multi languages, through I18n and some custom build systems. Everything is working fine. But with some public pages (none

I already a have a completely internationalize website already with content in multi languages, through I18n and some custom build systems. Everything is working fine. But with some public pages (none logged in part of the site), I would like to have different urls pointing to the different version of the content.

For instance, I have a page describing our pricing policy, that has a url that looks like this: http://www.mysite.com/pricing

To access the different language version of this page, I can add the local in front: http://us.mysite.com/pricing to get english and http://fr.mysite.com/pricing to get the french version, etc.

However I would to be able to change the complete url for the other language, I would like to access the french version of this page with:

http://fr.mysite.com/prix for instance.

I have found ways of doing this manually, but of course it does not interested me much of doing this manually, I would much prefer that the url be generated automatically with a proper开发者_如何学Go path. And obviously I would like that the original url for the fr version (http://fr.mysite.com/pricing) does not work anymore to avoid duplicate content under different URL which is not good for SEO.

Any advice, solution, best practice ?

Thanks,

Alex


I can partially try to answer your question. Duplicate contents it is a serious issue. The best way to go it is to use 301 permanent redirect to move your old URLs to your new one. Example: from http://fr.mysite.com/pricing to http://fr.mysite.com/prix for instance.

In this way you tell Search Engine that the content has moved to your new URL without loosing any ranking and avoiding duplicate content issues.

I suppose you can do automatically with some server side code, but I do not know about Rail so I'm not able to answer this point.

I hope can help.

0

精彩评论

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