dongxi7609 2015-05-08 12:30 采纳率: 0%
浏览 39
已采纳

Pimcore多语言站点静态路由

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.

Today the sites URL is my-site.com/LANGUAGE/sub-page For example: my-site.com/se/about

But what we would want to have is LANGUAGE.my-site.com/sub-page. For example: 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. I found the Pimcore documentation on static routes (HERE) but I didn't find it all that helpful.

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. 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.

  • 写回答

2条回答 默认 最新

  • duanhe0817825 2015-05-08 14:45
    关注

    There is the "Sites" - feature in Pimcore that lets you do this.

    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:

    Document Tree

    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":

    Multisites in Pimcore

    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.

    This is probably what you will see in a newer version after creating the site, right clicking it and going to "Edit Site":

    Pimcore Site options

    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. So what you need to do is enter your language-subdomain as main domain.

    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. 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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 求京东批量付款能替代天诚
  • ¥15 slaris 系统断电后,重新开机后一直自动重启
  • ¥15 51寻迹小车定点寻迹
  • ¥15 谁能帮我看看这拒稿理由啥意思啊阿啊
  • ¥15 关于vue2中methods使用call修改this指向的问题
  • ¥15 idea自动补全键位冲突
  • ¥15 请教一下写代码,代码好难
  • ¥15 iis10中如何阻止别人网站重定向到我的网站
  • ¥15 滑块验证码移动速度不一致问题
  • ¥15 Utunbu中vscode下cern root工作台中写的程序root的头文件无法包含