Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

RedirectTarget Not Working in AEM 6.2

Avatar

Level 4

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

25 Replies

Avatar

Level 2

Thanks for quick response Feike !

I found this issue in AEM6.1 with SP1 as well .
As a workaround I included page.jsp from foundation , to my project head.html which redirects the page to "redirectTarget" url.
Will it be fine to do like this or you recommend something which will be better than this workaround ?

Best Regards,
Talk.

Avatar

Level 4

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.

Avatar

Level 1

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.