Opening a page in author even after the page has redirect url | Community
Skip to main content
January 31, 2022
Solved

Opening a page in author even after the page has redirect url

  • January 31, 2022
  • 3 replies
  • 1744 views

Hi all,

In AEM author, I have opened a page (say URL1). I have set the Redirect path(in Advanced Tab) to URL2. So, Now if I open the page URL1 in author, publish environment, it will redirect to URL2. But author wants to open the URL1 page. Since he has to author URL1 page. Is this possible to open URL1 page?  At the end what I am asking is : Redirect should happen only in publish environment, not in author environment.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by JeevanRaj

Hi @gmahesh 

 

A condition to redirect only if wcmmode mode is disabled can be added in redirect.html. If you are using core components then you can overlay /apps/core/wcm/components/page/v2/page/page.html and add a condition similar to the below code.

<sly data-sly-test.isRedirectPage="${page.redirectTarget && (wcmmode.edit || wcmmode.preview)}"
data-sly-call="${redirect.redirect @ redirectTarget = page.redirectTarget}"></sly>
<sly data-sly-test="${!isRedirectPage}">
<sly data-sly-include="body.skiptomaincontent.html"></sly>
<sly data-sly-include="body.socialmedia_begin.html"></sly>
<sly data-sly-include="body.html"></sly>
<sly data-sly-call="${footer.footer @ page = page, pwa = pwa}"></sly>
<sly data-sly-include="body.socialmedia_end.html"></sly>
</sly> 

 

Refer this community answer for more info. https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/page-with-a-redirect-page-properties-opens-the-redirected-page/td-p/438455 

Thanks

3 replies

Anish-Sinha
Adobe Employee
Adobe Employee
January 31, 2022

hi @gmahesh,
You can easily achieve by overlaying the page component from here(/apps/core/wcm/components/page/v2/page/page.html) and adding a condition to check and make redirection or open page based on wcmmode.diabled or wcmmode.edit/wcmmode.preview

There is a same question and you can refer here: https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/page-with-a-redirect-page-properties-opens-the-redirected-page/td-p/438455

 

JeevanRaj
Community Advisor
JeevanRajCommunity AdvisorAccepted solution
Community Advisor
January 31, 2022

Hi @gmahesh 

 

A condition to redirect only if wcmmode mode is disabled can be added in redirect.html. If you are using core components then you can overlay /apps/core/wcm/components/page/v2/page/page.html and add a condition similar to the below code.

<sly data-sly-test.isRedirectPage="${page.redirectTarget && (wcmmode.edit || wcmmode.preview)}"
data-sly-call="${redirect.redirect @ redirectTarget = page.redirectTarget}"></sly>
<sly data-sly-test="${!isRedirectPage}">
<sly data-sly-include="body.skiptomaincontent.html"></sly>
<sly data-sly-include="body.socialmedia_begin.html"></sly>
<sly data-sly-include="body.html"></sly>
<sly data-sly-call="${footer.footer @ page = page, pwa = pwa}"></sly>
<sly data-sly-include="body.socialmedia_end.html"></sly>
</sly> 

 

Refer this community answer for more info. https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/page-with-a-redirect-page-properties-opens-the-redirected-page/td-p/438455 

Thanks

gmaheshAuthor
February 3, 2022

Thanks a lot dev_aem. Your answer is perfect one.  😀

JeevanRaj
Community Advisor
Community Advisor
February 3, 2022

Glad it helped 🙂

puneet_lamba
January 31, 2022

your question is unclear. "if I open the page URL1 in author, publish environment," - what does this mean?

 

from my experience redirected pages open fine in author (edit mode, not view as publish mode) and redirect in publish, which is what you would expect.

 

view as publish would behave as publish and would redirect, which is again as expected.