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.
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 help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
Hi @papenaarun
If I understand the requirement, based on query param you want to redirect to some destination?
for both the query param the destination URL is same or different?
RewriteCond %{REQUEST_URI} ^/abc
RewriteCond %{QUERY_STRING} ^page=page1$
RewriteRule (.*) /somepage [R=302,L]
RewriteCond %{REQUEST_URI} ^/abc
RewriteCond %{QUERY_STRING} ^page=page2$
RewriteRule (.*) /someotherpageurl [R=302,L]
302 can be updated with 301 once the development is completed.
Thanks!
Got it. So in both the cases you want to keep the user on the same page but want to show different content based on the query params that are coming as part of the URL?
If that;s the case then you must be using the [PT, L] in the Rewrite rule.
Hi @papenaarun
Rewrite Rule should be PT,L and L should be always at the end as from there it will stop processing. I see you are using it as [L, PT]
RewriteCond %{REQUEST_URI} ^/abc [NC]
RewriteCond %{QUERY_STRING} ^page=page1 [NC]
RewriteRule ^/(.*)$ /content/page1.html [PT,L]
RewriteCond %{REQUEST_URI} ^/abc [NC]
RewriteCond %{QUERY_STRING} ^page=page2 [NC]
RewriteRule ^/(.*)$ /content/page2.html [PT,L]
If the page 1 and page 2 has the content then it will work as there is no other logic that is driven by dispatcher. Please make the above change and try it out.
Thanks!
Hi @papenaarun
When you access /content/page1 does it call page1.model.json? If it's calling it then it should call here as well.
Can you please try with the below rules once? Made a minor change. Please make the exact rule change as I have mentioned here for each n every line.
RewriteCond %{REQUEST_URI} ^/abc [NC]
RewriteCond %{QUERY_STRING} ^page=page1$ [NC]
RewriteRule (.*) /page1 [PT,L]
RewriteCond %{REQUEST_URI} ^/abc [NC]
RewriteCond %{QUERY_STRING} ^page=page2$ [NC]
RewriteRule (.*) /page2 [PT,L]
Yes, I have made the change as you suggested.
Also, when I access /page1 then page1.model.json is getting called, and the same for page2.
Views
Replies
Total Likes
Hi,
I think your rules look fine, it just SPA app is not able to find out the pass-through link instead using the original requested link. TEST RESULT
@papenaarun - As per my experience with AEM SPA, you need to have one more rewrite rule for model.json as well.
Thanks,
Nikhil Kumar
Yes, but how do we know which page model.json has to load?
Because I will be receiving the request as abc.model.json
Hi ,
Did you get this resolved? What was the final rule that you added to resolve? Can you also share the full list of dispatcher rules you setup to resolve?
Views
Replies
Total Likes
Hi Nikil,
Can you share the rules?
Views
Replies
Total Likes
https://justpaste.it/edit/61801579/70ucvtjvfew7nkpy
https://651655c52f7fd.site123.me/blog-1/demystifying-backlink-monitoring-a-beginner-s-guide-to-under...
https://techrevolutionsnews.blogspot.com/2024/05/the-link-building-chronicles-navigating.html
https://penzu.com/p/50eda4dfec910f67
https://app.goodnightjournal.com/journal/5ccdc185-dbbe-4760-b3f6-df2613efc7e0
https://www.bloglovin.com/@technologynewsupdates/evolution-backlink-monitoring-in-seo-key-12592605
https://my-website923.yolasite.com/
https://www.storeboard.com/blogs/general/top-tools-for-backlink-monitoring-a-comprehensive-review/57...
https://technologynewsupdates.bcz.com/2024/05/02/mastering-backlink-monitoring-the-key-to-seo-succes...
https://technologynews692908442.wordpress.com/2024/05/03/vigilance-in-seo-the-crucial-role-of-contin...
https://technologynewsupdates.weebly.com/blog/building-strength-a-step-by-step-guide-to-monitoring-a...
https://site-7934474-3366-89.mystrikingly.com/blog/navigating-the-depths-leveraging-backlink-monitor...
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies