Expand my Community achievements bar.

AEM Cloud 404/500

Avatar

Level 2

Hi Folks,

 

We are on AEM Cloud - wanted to redirect 404/500 pages to respective country.

eg. If I'm on a Canada site and no resource found then it should redirect me to  /content/mysite/ca/errors/404.html

 

Similarly,

 

If I'm on a US site and no resource found then it should redirect me to  /content/mysite/us/errors/404.html

 

I know we can implement it like; but wondering how it could be done for multiple countries.

Define 404_PAGE /content/mysite/us/en/errors/404.html
Define 500_PAGE /content/mysite/us/en/errors/500.html
ErrorDocument 404 ${404_PAGE}
ErrorDocument 500 ${500_PAGE}
ErrorDocument 502 ${500_PAGE}
ErrorDocument 503 ${500_PAGE}
ErrorDocument 504 ${500_PAGE}

 

Note: We don't want to use ACS Commons.

 

 

1 Reply

Avatar

Community Advisor

@Gatsby this can only be done with the help of rewrite rules to check for country code and redirect if we don't want to use ACS Error Handler.

 

<LocationMatch "^/content/mysite/us/en/errors/en/.*$">
    ErrorDocument 404 "/content/mysite/us/en/errors/404.html"
    ErrorDocument 500 "/content/mysite/us/en/errors/500.html"
</LocationMatch>

<LocationMatch "^/content/mysite/ca/en/.*$">
    ErrorDocument 404 "/content/mysite/ca/en/errors/404.html"
    ErrorDocument 500 "/content/mysite/ca/en/errors/404.html"
</LocationMatch>

 

 

 

Please find below link which talks about same implementation what we are looking for:

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/how-to-set-errordocument-d...