AEM 6.5 | Dispatcher Rewrite Rule | Community
Skip to main content
Level 2
May 7, 2020 7:14 AM UTC
Solved

AEM 6.5 | Dispatcher Rewrite Rule

I have the below requirement:

 

Suppose when the end user enters http://abc-123.co.in , the rewrite rule should be set in such a way that the URL is internally expanded to its home page full URL say http://abc-123.co.in/en/home.html but the full URL should not be visible on the address bar to the end user but rather be seen as http://abc-123.co.in (with .html extension and repo structure upto 'home' removed). How do we set up a rewrite rule for this?

 

Similarily, when the end user clicks on say, http://abc-123.co.in/en/home/about-us.html from the home page, again the full URL should not be visible to the end user but rather be seen as http://abc-123.co.in/about-us (with .html extension and repo structure upto 'home' removed). How do we set up a rewrite rule for this? 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
arunpatidar
arunpatidarAccepted solution
New Participant
May 7, 2020 6:39 PM UTC

1. add entry in resource mappings at OSGI config in AEM 

/config.publish/org.apache.sling.jcr.resource.internal.JcrResourceResolverFactoryImpl.xml

resource.resolver.mapping="[/:/,/content/myproj/en/home:/]"

 

2. Add Apache server rewrite rules

RewriteRule ^/$ /content/myproj/en/home.html [PT,NE,L]

RewriteRule ^/(.*)$ /content/myproj/en/home/$1 [PT,NE]

Arun Patidar

1 reply

arunpatidar
arunpatidarAccepted solution
New Participant
May 7, 2020 6:39 PM UTC

1. add entry in resource mappings at OSGI config in AEM 

/config.publish/org.apache.sling.jcr.resource.internal.JcrResourceResolverFactoryImpl.xml

resource.resolver.mapping="[/:/,/content/myproj/en/home:/]"

 

2. Add Apache server rewrite rules

RewriteRule ^/$ /content/myproj/en/home.html [PT,NE,L]

RewriteRule ^/(.*)$ /content/myproj/en/home/$1 [PT,NE]

Translate
Arun Patidar