Expand my Community achievements bar.

SOLVED

AEM dispatcher - Ignore pages after particular page location

Avatar

Level 5

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!

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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]

View solution in original post

4 Replies

Avatar

Community Advisor

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

 

Avatar

Level 5

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 

Avatar

Correct answer by
Community Advisor

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]

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