Custom 404 in a subfolders

Hi, how can subfolders be made to have their own 404 error. For example, themain 404 page is from the root directory (/404.html), but subfolders can also have their own 404 page (/subfolder/404.html), it is possible ?