[英]Pimcore multilanguage site static route
I've just recently started working with Pimcore in my work and I'm now on a project consisting of three languages each in their seperate tree. 我最近刚开始在Pimcore中工作,现在我在一个项目中,该项目由三种语言组成,每种语言分别位于各自的树中。
Today the sites URL is my-site.com/LANGUAGE/sub-page For example: my-site.com/se/about 今天,网站网址为my-site.com/LANGUAGE/sub-page,例如:my-site.com/se/about
But what we would want to have is LANGUAGE.my-site.com/sub-page. 但是我们想要的是LANGUAGE.my-site.com/sub-page。 For example: se.my-site.com/about
例如:se.my-site.com/about
I've tried using the static route tool but couldn't get it to work at all and my knowledge of pimcore is somewhat limited. 我已经尝试过使用静态路由工具,但根本无法使用它,而我对pimcore的了解也很有限。 I found the Pimcore documentation on static routes ( HERE ) but I didn't find it all that helpful.
我在静态路由( HERE )上找到了Pimcore文档,但没有发现所有帮助。
Do I need a controller and an action to handle this. 我需要一个控制器和一个动作来处理这个问题。 Or can it be done simply with the static route tool?
还是可以简单地使用静态路由工具来完成?
EDIT: I've tried to use the "domain tool" from when you right-click a site. 编辑:当您右键单击站点时,我尝试使用“域工具”。 But this only works if I change in the hosts file of the computer by setting 127.0.0.1 to be connected to us.MYSITE.com.
但这仅在我通过将127.0.0.1设置为连接到us.MYSITE.com来更改计算机的主机文件时有效。 Won't this be an issue for when the site goes live?
网站上线时这不是问题吗? Since the users don't have my hosts file.
由于用户没有我的主机文件。 That is why I went down the road of static routes.
这就是为什么我走静态路线的原因。
There is the "Sites" - feature in Pimcore that lets you do this. Pimcore中有“站点”功能,可让您执行此操作。
The documentation page describes how you set this up, but I'll explain it quickly: 文档页面介绍了设置方法,但我将对其进行快速解释:
You basically set up your document tree like this, creating a usual document for each of your languages: 基本上,您像这样设置文档树,为每种语言创建普通文档:
After this, all you need to do is change these documents into "Sites" (picture taken from the docs) by right clicking and clicking "Use as site": 之后,您需要做的就是通过右键单击并单击“用作站点”将这些文档更改为“站点”(从文档中拍摄的图片):
As you can see, the popup now offers you a field where you can add and edit new domain-names, as well as subdomains. 如您所见,弹出窗口现在为您提供一个字段,您可以在其中添加和编辑新域名以及子域。 Depending on what version of Pimcore you are using, this may look a little different, the documentation shows an older version.
根据您使用的Pimcore版本,此外观可能有所不同,该文档显示的是较旧的版本。
This is probably what you will see in a newer version after creating the site, right clicking it and going to "Edit Site": 创建站点,右键单击该站点并转到“编辑站点”后,您可能会在较新的版本中看到以下内容:
This offers a slightly nicer way to manage your domains and additional ones, you don't have to add additional domains by editing a comma seperated list, now every line in the textarea resembles a domain. 这提供了一种管理域和其他域的更好的方法,您不必通过编辑逗号分隔的列表来添加其他域,现在textarea中的每一行都类似于一个域。 So what you need to do is enter your language-subdomain as main domain.
因此,您需要做的是输入您的language-subdomain作为主域。
The site now acts exactly like the "Home" - Site at the Document-Root and the Site - feature acts similar to a static route you would set up. 现在,该站点的行为与“主页”(文档根目录中的站点和站点)功能完全相同,其作用类似于您要设置的静态路由。
Now what you need to do additionally is set your server up to route the subdomain to your pimcore - folder, this answer will probably help you out . 现在,您需要做的其他事情是将服务器设置为将子域路由到pimcore-文件夹, 此答案可能会帮助您 。 There won't be a problem with the host - files as you mentioned, as they are stored on the server anyhow, the user does not need to have these, so using the "Sites"-feature is definitely the way to approach this problem over the static route - tool.
主机不会有问题-正如您所提到的,文件无论如何都存储在服务器上,用户不需要这些文件,因此使用“站点”功能绝对是解决此问题的方法通过静态路径-工具。
Common approach to multilingual sites is to create separate document trees for each language and setup content-master documents (known as content inheritance feature). 多语言站点的常见方法是为每种语言创建单独的文档树并设置内容主文档(称为内容继承功能)。 Then for each additional language you can create "site" and setup different subdomain.
然后,对于每种其他语言,您可以创建“站点”并设置不同的子域。
- home (main launguage, main domain)
- subpage_1
- subpage_2
- de (site = de.example.com)
- subpage_1 (master-document = /home/subpage_1)
- subpage_2 (master-document = /home/subpage_2)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.