Opening a page in author even after the page has redirect url | Community
Skip to main content
Level 2
Jan 31, 2022 5:44 AM UTC
Solved

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

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.
JeevanRaj
JeevanRajAccepted solution
New Participant
Jan 31, 2022 2:52 PM UTC

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

7 replies

puneet_lamba
Level 2
Jan 31, 2022 4:34 PM UTC

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.

 
 
 

 

Translate
JeevanRaj
JeevanRajAccepted solution
New Participant
Jan 31, 2022 2:52 PM UTC

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

Translate
gmaheshAuthor
Level 2
Feb 3, 2022 4:38 AM UTC

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

Translate
JeevanRaj
New Participant
Feb 3, 2022 6:19 AM UTC

Glad it helped 🙂

Translate
Anish-Sinha
Employee
Jan 31, 2022 2:49 PM UTC

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

 

Translate