多语言网站 [英] Multiple Language Website

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

问题描述

我想有两种语言在我的网站。荷兰和英国。我已经有英语和在en和NL在我的根文件夹中的荷兰网站。

I would like to have two languages on my website. Dutch and English. I already have the English and the Dutch website in the "en" and "nl" folders in my root.

怎样还是怎样将重定向他们的最好方法是什么?的.htaccess或PHP。你能告诉我怎么样?

How or what would be the best way to redirect them? .htaccess or PHP. And can you tell me how?

推荐答案

htaccess的在我看来,要容易得多。使用PHP,你就必须做一个AUTO_ prePEND文件,我猜。另一件事要记住的是,使用相同的页面,所以选择一种语言,并利用它来进行网址....即EN / about_us.html和NL / about_us.html存在是导致然后谷歌可以找出原因哪些页是相同的,但不同的语言。在改写的方面,如果你有到位的文件夹,然后我不明白你需要重写的。请你给我更多的信息。每当我做一个多语种的网站我的控制器都是一样的(当然,在一个MVC环境),我只是有两种不同的意见。在这种情况下,它会是这样的重写

htaccess seems to me to be so much easier. With php you would have to do an auto_prepend file I'm guessing. Another thing to keep in mind is to use the exact same page, so pick a language and use that for the url....ie en/about_us.html and nl/about_us.html the reason being is cause then google can figure out which pages are the same, but different languages. In terms of the rewrite if you have the folders in place then I don't see what you need a rewrite for. Will you please give me more information. Whenever I make a multilingual site my controllers are the same (in an mvc environment of course) and I just have two different views. In that case it'd be a rewrite like this

RewriteRule en/(.*).html /$1.php?language=en
RewriteRule nl/(.*).html /$1.php?language=nl

RewriteCond %{HTTP_ACCEPT_LANGUAGE} ^(en)
RewriteRule ^[^en/](.*) /en/$1 [R=301]
RewriteCond %{HTTP_ACCEPT_LANGUAGE} ^(nl)
RewriteRule ^[^nl/](.*) /nl/$1 [R=301]

这篇关于多语言网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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