Expand my Community achievements bar.

Rewrite Rules in AEM Dispatcher are not working for AEM - React SPA

Avatar

Level 3

We are using AEM - React as a SPA.
The Rewrite Rules which are configured for URL shortening were not working with this AEM-React SPA.

We have made some changes in HierarchyPageImpl class so that :path will be specific to the short URL. And the changes are working fine.

But, we have a new use case where we a URL for which there will be different values for a query param. And based on that I need to load a specific page.
Ex:

When users access the below URLs, I need to check the param value and rewrite the rule based on that.

I am able to load those pages but the content for them is still on https://domain/abc page.

https://domain/abc?page=page1

https://domain/abc?page=page2


Below are the Rules I have configured:

RewriteCond %{REQUEST_URI} ^\/abc [NC]
RewriteCond %{QUERY_STRING} ^page=page1 [NC]
RewriteRule ^/(.*)$ /content/page1.html [L,PT]

 

RewriteCond %{REQUEST_URI} ^\/abc [NC]
RewriteCond %{QUERY_STRING} ^page=page2 [NC]
RewriteRule ^/(.*)$ /content/page2.html [L,PT]




I am not able to figure out how this can be handled.

 

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

16 Replies