URL Mapping based on Resource resolver in AEM

不想你离开。 提交于 2019-12-01 09:47:29

问题


We have the following website structure:

content
    mysite
         en
          home
             testlevel1page
               testlevel2page

Now the requirement is to map:

  • http://www.mysite.com/ --> /content/mysite/en/home.html
  • http://www.mysite.com/testlevel1page/ --> /content/mysite/en/home/testlevel1page.html
  • http://www.mysite.com/testlevel1page/testlevel2page/ --> /content/mysite/en/home/testlevel1page/testlevel2page.html

How can we achieve this through resource resolver?


回答1:


Under the /etc/map/http directory, add a node "www.mysite.com" and give this a sling:internalRedirect property of /content/mysite/en/home.

As per the Sling documentation, this will "prefix the URI paths of the requests sent to this domain with the string" — i.e. in this case, appending "/content/my/en/home" after the domain name for any incoming requests to "www.mysite.com".

Optionally, if you place this under /etc/map.publish/http, this will only be applied to instances with a Sling run mode set to publish.

(As the rule is under a node called 'http', this won't be applied to secure requests. If you need to cater for 'https' too, you could copy the http node, or preferrably create a regex — this isn't as common a use case, but more info on the docs linked above.)



来源:https://stackoverflow.com/questions/21194654/url-mapping-based-on-resource-resolver-in-aem

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!