Skip to main content
vinceg62980830
April 16, 2018

AEM - Set External Page Redirect that carries Query Parameters

Hi everyone,

Not sure if anyone else had come across this similar situation...

We want to leverage the "Page Redirect" placeholder page, or even the Redirect field in a page's Page Properties, to setup a "single/global redirect" to a sister website. However, we need to be able to pass-thru query parameters during that redirect.

So for example:

AEM == https://www.mysite.com/

Sister site == https://www.sistersite.com/

We'd like to have URLs that point to the sister site, and rather than always manually inputting their URL we'd like to setup an AEM webpage that redirects, so:

AEM page == https://www.mysite.com/content/gotosister --> https://www.sistersite.com/

The kicker is, current redirects using either the "Page Redirect" placeholder page or the Page Properties redirect strips out any Query Params that may be on it. Is there a way for it to retain/pass-thru query params? So:

https://www.mysite.com/content/gotosister?param=foo --> https://www.sistersite.com/?param=foo

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

2 replies

edubey
Level 10
April 17, 2018

You properly would have to overlay this file  /libs/foundation/components/page/redirect.jsp or /libs/wcm/foundation/components/page/redirect.html and correct logic for your use case. Doesn't seems to be much of work.

Translate
vinceg62980830
April 19, 2018

Thanks for responding, @edubey.

I see that the HTL is already appending .html to the path:

<p data-sly-test="${properties.redirectTarget}" class="cq-redirect-notice">

    This page redirects to <a href="${properties.redirectTarget}.html">here</a>

</p>

how would we pass params after that appended .html portion?

Translate