ObjectNotFound throws error instead-of 404 for wrong directory

I added a error.cfm for 404 error and using onMissingTemplate in Application.cfc.
But, it only works for a cfm template is missing. But, not working for a directory if missing.

For example,
https://testbox.lucee.com/404.cfm,
Correctly shows the error template while that file is missing using onMissingTemplate. But if we test with https://testbox.lucee.com/test means, it throws an object not found error by APACHE.

For one of fix, I added errordocument 404/error.cfm in my local setup to resolves the issue.
So, if we add means, it’ll easily help to prevent that issue and can able to show our template.

Please share your thoughts about anything related to this.

Is your apache DirectoryIndex set to index.cfm?

the ajp connector config usually only handles .cf* files, so it will be defaulting to .html or .htm which never gets to Lucee / error handling, hence the apache error

Is your apache DirectoryIndex set to index.cfm ?

Yes, @Zackster. But, not only index.cfm. There is few file types also exists.

you could try something like

ErrorDocument 404 /404.cfm
https://httpd.apache.org/docs/2.4/mod/core.html#errordocument

Oh, @Zackster. Already I tried this way. Did you see the above?

I did the first time, but then only read the last reply :slight_smile:

@Zackster Actually I try this for the download page to show the 404 template for missingt emplate. So I created a topic here for some suggestions :slightly_smiling_face:.