AnsweredAssumed Answered

Custom 404 error message if document not found

Question asked by bbiais on May 17, 2016
Hello,

I want to display a custom error message when file is not found using "View in browser" feature in Alfresco Share.

Example test file:
https://mydomain/share/proxy/alfresco/api/node/content/workspace/SpacesStore/70d263f4-f9e6-498d-93b2-549f64fbaa83/test1.txt

My document test1.txt doesn't exist so Alfresco return an standard error message with all traces. OK.
However, I don't want my users see this page.
I would like to replace this with a custom page or friendly message.

Following these subjects:
http://ecmarchitect.com/alfresco-developer-series-tutorials/webscripts/tutorial/tutorial.html#your-first-web-script
https://forums.alfresco.com/forum/developer-discussions/web-scripts/friendly-error-pages-02192009-1431

I created a plain text file nammed 404.html.ftl in Data Dictionnary/Web Scripts folder, with custom content:


<html>
<body>
<p>My custom message.</p>
</body>
</html>


Refresh the webscript and put the test file URL, I still get the Alfresco standard error message (cf AlfrescoError404_fileNotFound.png)

Rename 404.html.ftl to 404.ftl, refresh the webscript, and I get the browser error message for 404 error, but not my custom message (cf IEError404_fileNotFound.png).

How can I display my custom message?

Thanks for your help.

Outcomes