AEM中基于资源解析器的URL映射 [英] URL Mapping based on Resource resolver in AEM

查看:66
本文介绍了AEM中基于资源解析器的URL映射的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们具有以下网站结构:

We have the following website structure:

content
    mysite
         en
          home
             testlevel1page
               testlevel2page

现在的要求是映射:

  • 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?

推荐答案

/ etc / map / http 目录下,添加一个节点 www.mysite.com,并为其添加 sling:internalRedirect / content / mysite / en / home 属性。

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

根据 Sling文档,这将使用字符串在发送到该域的请求的URI路径前面加上前缀 –即,在这种情况下,将任何传入请求的域名后的 / content / my / en / home附加到 www。 mysite.com。

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

(可选)如果将其放在 /etc/map.publish/http 下只会应用于Sling运行模式设置为发布的实例。

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.

(由于规则位于名为 http的节点下,这不会应用于安全请求。如果您也需要迎合 https,则可以复制http节点,或者最好创建一个正则表达式-这不是一个用例,而是上面链接的文档的更多信息。)

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

这篇关于AEM中基于资源解析器的URL映射的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆