. Moved 404 reply up to stat() section. . Redirect /dir to /dir/ . Separate permissions (403 Forbidden) from other fopen() failures (500 Internal Server Error)