RedirectTarget Not Working in AEM 6.2 | Community
Skip to main content
Level 4
November 7, 2016

RedirectTarget Not Working in AEM 6.2

  • November 7, 2016
  • 2 replies
  • 9667 views

Hi Team,

Page properties redirectTarget property is not working in AEM 6.2.

Even it's not working on we retail reference site.

If someone have faced this issue.Please help us.

Regards

Ankur

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

2 replies

Feike_Visser1
Adobe Employee
Adobe Employee
November 7, 2016

Can you share more details?

Level 4
November 7, 2016

Feike Visser wrote...

Can you share more details?

 


Hi Feike,

I have created a page component same as we retail reference site then using this page componenti have created a template using template editor.

Using which i have created a page .

On this page if we go to page properties -->advanced tab ----> redirect path property and configure a path , page should be redirected to corresponding page but it's not happening in my custom template and even on reference site.

Regards

Ankur

Level 4
November 10, 2016

Can you try this redirection on publish?


Feike Visser wrote...

Can you try this redirection on publish?

 


In 5.6 we use to inherit this page component -

/libs/foundation/components/page/page.jsp

 

which use to have following code for redirection-

 // read the redirect target from the 'page properties' and perform the
    // redirect if WCM is disabled.
    String location = properties.get("redirectTarget", "");
    // resolve variables in path
    location = ELEvaluator.evaluate(location, slingRequest, pageContext);
    boolean wcmModeIsDisabled = WCMMode.fromRequest(request) == WCMMode.DISABLED;
    boolean wcmModeIsPreview = WCMMode.fromRequest(request) == WCMMode.PREVIEW;
    if ( (location.length() > 0) && ((wcmModeIsDisabled) || (wcmModeIsPreview)) ) {
        // check for recursion
        if (currentPage != null && !location.equals(currentPage.getPath()) && location.length() > 0) {
            // check for absolute path
            final int protocolIndex = location.indexOf(":/");
            final int queryIndex = location.indexOf('?');
            String redirectPath;

            if ( protocolIndex > -1 && (queryIndex == -1 || queryIndex > protocolIndex) ) {
                redirectPath = location;
            } else {
                redirectPath = slingRequest.getResourceResolver().map(request, location) + ".html";
            }

            // include wcmmode=disabled to redirected url if original request also had that parameter
            if (wcmModeIsDisabled) {
                redirectPath += ((redirectPath.indexOf('?') == -1) ? '?' : '&') + "wcmmode=disabled";
            }

            response.sendRedirect(redirectPath);

 

Now in 6.2 we are using sightly and we are having super resource type as -

/libs/wcm/foundation/components/page

 

And this doesnt have any code like above for redirection.

January 30, 2018

So any outcome? Is this going be fixed in any of the CFPs? or in AEM 6.3, 6.4?

A client was asking about this functionality and I had to tell them Adobe is aware that this is an issue and is working on it.