If an incorrect __data path is entered for our site we see the Apache 404 page rather than the Matrix one. This seems to be incorrect - can this be corrected? If so, how?
Files from __data serve from apache for performance so Matrix doesn't know about it and can't give you the Matrix not found page. The way to run it back through Matrix is to set the "Allow Unrestricted Access" to NO on the details screen. This does mean that the file will be served through Matrix which adds all the overheads of permission checking etc.
Thanks Shane.
Another way of doing this is to set the 404 error handler in Apache to point to Matrix so that it shows your site's 404 page.
Add this line to your Apache VirtualHost config:
ErrorDocument 404 /var/www/mysource_matrix/core/web/index.php
(Replace [i]/var/www/mysource_matrix[/i] with the path of your Matrix system root)
I'd tend to prefer this solution over setting images/files to "Allow unrestricted access: No", as that has a performance hit on your server (and there are cases where you might fail to set this anyway).
Note that I don't think Matrix caches 404 pages, so a heavy 404 page with lots of traffic will also create some page generation load on your system.
Matrix doesn't cache 404 pages because there is no asset to cache against, but it will send cacheable headers so a proxy (if you use one) will cache the result.