Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

Show Custom 404 error message

Avatar

Level 1

Hi Team,
I only want to show custom 404 error message for my site having path "/content/mySite/".

I have overlayed "/libs/sling/servlet/errorhandler/" but this is working for every path.

4 Replies

Avatar

Level 3

Hi @VivekSr1 
It is ideal to use same error page for all content tree and you can configure in dispatcher if you need locale specific error page. If there is any requirement for content tree specific error page then use acs commons error handler https://adobe-consulting-services.github.io/acs-aem-commons/features/error-handler/index.html

Avatar

Community Advisor

Hi @VivekSr1 

 

You are right, overlaying the OOTB servlet handler will do this across the environment. Instead you can leverage the ACS AEM Commons Error page handler for this requirement. Refer below links for details -

 https://adobe-consulting-services.github.io/acs-aem-commons/features/error-handler/index.html

https://medium.com/@toimrank/aem-acs-commons-error-page-handling-a84549761260

 

Thanks

Narendra

Avatar

Level 1

Hi @narendragandhi ,

I follow the process and did the same .
After deploying my changes 404 is coming as configured but It is conflicting my authoring environment like configuration icon is not showing. Please help.

Avatar

Community Advisor

Hi @VivekSr1 ,

One approach can be enabling DispatcherPassError  at dispatcher level using ErrorDocument

In LocationMatch we can mention the path pattern

https://experienceleague.adobe.com/en/docs/experience-manager-dispatcher/using/getting-started/dispa...

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/aem-dispatcher-errordocume...

https://www.digitalocean.com/community/tutorials/how-to-configure-apache-to-use-custom-error-pages-o...

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/dispatcher-module-throws-e...

 

<LocationMatch />
ErrorDocument 404 /content/aemlab/404.html
ErrorDocument 403 /content/aemlab/403.html
ErrorDocument 500 /content/aemlab/500.html
</LocationMatch>

Thanks