简体   繁体   中英

How to assign multiple url patterns to same container page in opencms

I want to call particular container page with different url patterns

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

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

here account-details is the common container page. where xxxx value changes every time.

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

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;
  3. You may implement some kind of vfs driver that is aware of that behaviour (I think to much complicated).

Second solution is what I used it in a project just finished adapted to your case.

in the httpd virtual host:

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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