AEM Redirect not working expected on the publish.
Hi team,
I need help for the redirect issue.
All my contents are under /content/proj. The dispatcher is under /var/cache/content/proj, all rewrites are rewritten to /var/cache/content/proj. So an article in author /content/proj/news/xyz.html will be https://mysite.com/news/xyz.html. This works under the dispatcher rewrite rules.
I have a page /content/proj/about/about-me.html, it works fine. Now I set up its parent /content/proj/about, it has a redirect as a "
granite/ui/components/coral/foundation/form/pathfield", the value is /content/proj/about/about-me.html, the name for the field is "cq:redirectTarget". On the author it just shows the title of the /content/proj/about/about-me.html, but the front-end just being redirected to https://mysite.com/content/proj/about/about-me.html, in turn, resulted a 404 page. Since this is a pathfield field, I don't want to just enter /about/about-me.html for the redirect, rather, pick a page from the AEM built-in popup/popdown path field. I try to implement a model to redirect it, such as
String redirectPath = properties.get("cq:redirectTarget", "");
if(redirectPath != null && !redirectPath.equals(""))
{
response.sendRedirect(redirectPath);
}
It's weird that the author shows the correct redirectPath, but not the publisher because the page is always located at 404. In other words, the model always kicks in after the redirect on the publish server. Is there a config under /system/console/configMgr doing this?
Appreciate your help!
-kt