Dispatcher rewrite rule for redirection to a sling servlet | Community
Skip to main content
Adobe Champion
May 27, 2022
Solved

Dispatcher rewrite rule for redirection to a sling servlet

  • May 27, 2022
  • 1 reply
  • 1200 views

Can someone help me with the rewrite rule for the below scenario?

 

If I hit http://test.test.ca/reader?id=0f69571b-a2ce-4c04-8df8-dc46b137f677 should redirect to this url http://test.test.ca/apps/sling/servlet/asset/test-reader?id=0f69571b-a2ce-4c04-8df8-dc46b137f677, Here id is dynamic and will be different each request and apps/sling/servlet/asset/test-reader is where the resourcetype node reside for my servlet.

 

@arunpatidar 

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

Hi,

Its not needed, you can test the rule in the link which I have shared or in local dispatcher setup


I had to add a slash to the above rule you gave as below

 

RewriteRule "^/reader""/apps/sling/servlet/asset/test-reader"[PT]

 

and that worked. Thanks a lit @arunpatidar 

 

 

1 reply

arunpatidar
Community Advisor
Community Advisor
May 27, 2022
P_V_NairAdobe ChampionAuthor
Adobe Champion
May 27, 2022

Thanks @arunpatidar . The anonymous read only access to that node is already in place and so we are good with that perspective. 

But I have a doubt in the rewrite rule. So, shouldn't add anything related to id in the rewrite rule?

arunpatidar
Community Advisor
Community Advisor
May 27, 2022

Hi,

Its not needed, you can test the rule in the link which I have shared or in local dispatcher setup

Arun Patidar