Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.

React redirection

Avatar

Level 2

We have a requirement  in our AEM SPA website to internally redirect to new page when user hit the old page hierarchy. So the old pages are not present in AEM physically. There is also a requirement that URL on browser should not change. So we used PT in rewrite rule.

For example http://domain/content/mysite/in/en/oldpage/scheme.html  should be redirected to http://domain/content/mysite/in/en/newpage.html 

Here is our redirect rule:

RewriteCond %{REQUEST_URI} ^/content/${CONTENT_FOLDER_NAME}/in/en/oldpage/(.*?)\.html$ [NC]
RewriteRule ^/content/${CONTENT_FOLDER_NAME}/in/en/oldpage/(.*?)\.html$ /content/${CONTENT_FOLDER_NAME}/in/en/newpage.html [PT,L]

RewriteCond %{REQUEST_URI} ^/content/${CONTENT_FOLDER_NAME}/in/en/oldpage/(.*?)\.model.json$ [NC]
RewriteRule ^/content/${CONTENT_FOLDER_NAME}/in/en/oldpage/(.*?)\.model.json$ /content/${CONTENT_FOLDER_NAME}/in/en/newpage.model.json [PT,L]

Here redirection is working as expected. Page is getting redirected to newpage.html but content is not getting displayed. We see a blank page.

When we set isRoot as false in page policy, redirection is working fine. But on click of any links, only URL get change, and not that page content. When we refresh page, content is getting rendered.

 

@Shashi_Mulugu @Nikhil-Kumar @Raja_Reddy @kautuk_sahni 

 

 

 

 

 

 

1 Reply

Avatar

Level 5

Hi @ataemuser ,

 

Kindly share / check the dispatcher logs and network tab whether any response is getting blocked / status code.

Check and update allow and deny paths in your dispatcher configuration accordingly.

Also hopefully you may be checking by removing cache or rerun apache

 

Thanks,