AEM dispatcher - Ignore pages after particular page location | Community
Skip to main content
RitendraS11
Level 4
December 9, 2021
Solved

AEM dispatcher - Ignore pages after particular page location

  • December 9, 2021
  • 2 replies
  • 1586 views

I have a component - The component is loading a third-party script and it has many links as child pages. I need to ignore any URL after the mentioned page-path in AEM and allow the third-party script to take control of navigation and URL formation afterwards.

So, I need to ignore any URL after the specified page-path in order not to throw 404s from web-server.

I am using AEM dispatcher and need help as if where this code should be added (as we don't have any .htaccess file). I have tried adding it in dispatcher.any file. But, it doesn't work.

E.g., URL is : https://domain-website/test-page/<anything-after-this-needs-to-be-ignored>

<Directory "domain-website/en/test-page">
Options +FollowSymLinks
IndexIgnore *
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.html
</Directory>

 Also, I have the below code in my dispatcher.any file (It's present in WKND project as well)

<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>

 Please help as if where should I add the required code and how it can be achieved in AEM. Thanks for the help!

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 Singaiah_Chintalapudi

You can't put this in the dispatcher.any file. You should have the access to rewrite files and ideally, you should out a simple rewrite to handle this in the rewrites files.

 

RewriteRule "^(?i)/test-page/" "https://%{HTTP_HOST}/index.html" [L,R=301]

2 replies

Raja-Karuppsamy
Community Advisor
Community Advisor
December 9, 2021

@ritendras11 Instead of adding these configuration in dispatcher.any file, you can add them in virtual host file & test it.

 

RitendraS11
Level 4
December 10, 2021

Thanks for your inputs! I was able to add the desired code under virtualHost conf file. The only stuff is like IndexIgnore was throwing error to me. I have referred this page for more info and removed it -http://www.maxi-pedia.com/indexignore 

Singaiah_Chintalapudi
Singaiah_ChintalapudiAccepted solution
Level 7
December 9, 2021

You can't put this in the dispatcher.any file. You should have the access to rewrite files and ideally, you should out a simple rewrite to handle this in the rewrites files.

 

RewriteRule "^(?i)/test-page/" "https://%{HTTP_HOST}/index.html" [L,R=301]

RitendraS11
Level 4
December 10, 2021

Thanks for the valuable inputs. I have tried the solution of adding it inside VirtualHost and it looks fine.