AEM 6.5 | Dispatcher Rewrite Rule

Avatar

Avatar

abn93

Avatar

abn93

abn93

07-05-2020

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? 

Dispatcher Rewrite Rules

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

Arun_Patidar

MVP

Total Posts

2.9K

Likes

1.0K

Correct Answer

831

Avatar

Arun_Patidar

MVP

Total Posts

2.9K

Likes

1.0K

Correct Answer

831
Arun_Patidar
MVP

07-05-2020

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]

Answers (0)