如何映射网址? [英] How to map urls?

查看:127
本文介绍了如何映射网址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将 domain / content / myProject / home.html 的页面映射到 domain / home.html 。不需要 / content / myProject / 。我有以下代码:

I would like to map pages such domain/content/myProject/home.html to domain/home.html. /content/myProject/ is not needed. I have the following code:

 String newpath = getResourceResolver().map(page.getPath());

这不会更改任何内容。 newpath是stay page.getPath()

this does not change anything. newpath is stay page.getPath()

如何解决此问题?

推荐答案

回答此问题,因为它仍未得到回答。以下是etc映射的外观示例:

Answering as this question as it remains unanswered. Here is an example of how the etc mappings should look like:

技巧是您添加2个条目到sling:internalRedirect为/和/ content / example /

Trick is you add 2 entries to sling:internalRedirect as / and /content/example/

AEM首先尝试使用第一个条目 /解析资源。因此,第一个条目将处理非页面URL,例如/ etc / designs,/ content / dam等。如果无法使用第一个方法解析,则使用第二个条目来解析页面。

AEM first tries to resolve resources with first entry '/'. So non page URLs like /etc/designs, /content/dam etc will be addressed by the first entry. If it is unable to resolve using the first one, it uses the second entry to resolve the page.

与其他技术相比,这也是Adobe推荐的URL缩短方法像apache重定向。

This is also the adobe recommended way for URL shortening compared to other techniques like apache redirect.

这篇关于如何映射网址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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