简体   繁体   English

如何在opencms中将多个url模式分配给同一个容器页面

[英]How to assign multiple url patterns to same container page in opencms

I want to call particular container page with different url patterns我想用不同的 url 模式调用特定的容器页面

www.abc.com /accounts/india- accounts /account-details?id= XXXXX www.abc.com/accounts/india-accounts/account-details?id=XXXXX

www.abc.com/ accounts /india- accounts / account-details /xxxxx www.abc.com/accounts/india-accounts/account-details/xxxxx

here account-details is the common container page.这里的 account-details 是公共容器页面。 where xxxx value changes every time.其中 xxxx 值每次都会更改。

I haven't find a way to do it yet.我还没有找到办法做到这一点。 Opencms need to have a vfs resource in db to be referenced, if you have no resource 404 is "thrown". Opencms需要在db中有一个vfs资源被引用,如果你没有资源404被“抛出”。

There are some ways you can walkaround it.有一些方法可以绕过它。

  1. If you have few resources, use siblings;如果你的资源很少,就使用兄弟姐妹;
  2. If you have undefined numbers of possible combinations, I would use apache httpd (or varnish or nginx or whatever you like) rewrite rule;如果您有未定义数量的可能组合,我将使用 apache httpd(或 varnish 或 nginx 或任何您喜欢的)重写规则;
  3. You may implement some kind of vfs driver that is aware of that behaviour (I think to much complicated).您可能会实现某种可以识别该行为的 vfs 驱动程序(我认为非常复杂)。

Second solution is what I used it in a project just finished adapted to your case.第二个解决方案是我在刚刚完成的项目中使用它来适应您的情况。

in the httpd virtual host:在 httpd 虚拟主机中:

RewriteCond %{REQUEST_URI} ^/accounts/india-accounts/account-details/.*$
RewriteRule ^/[^/]+/accounts/india-accounts/account-details/.*([^/]+)/?.*$ %{REQUEST_URI}?id=$1 [QSA]

RewriteCond %{REQUEST_URI} ^/accounts/india-accounts/account-details.*$
RewriteRule ^/accounts/india-accounts/account-details.*$ /opencms/opencms/accounts/india-accounts/account-details [PT,QSA]

Hope it helps希望能帮助到你

What do you want exactly?你究竟想要什么?

I think you just want to use the value of the id=XXX to do something with the container.我认为您只想使用 id=XXX 的值对容器进行处理。 Something like thishttp://aeromexico.com/es/viaja-con-aeromexico/equipaje/?site=mx , if you change de 'mx' to 'ar' the text and the flag will change.像这样的http://aeromexico.com/es/viaja-con-aeromexico/equipaje/?site=mx ,如果您将 de 'mx' 更改为 'ar' 文本和标志将更改。

To do this you just have to use a scope in your template.为此,您只需在模板中使用范围。 Remember is the first thing loaded.记住是加载的第一件事。 Or if you want to change the container example from content-type list to something else you will need the exact location of that content-type.或者,如果您想将容器示例从内容类型列表更改为其他内容,您将需要该内容类型的确切位置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM