First, you will need to create your custom error page and name it 404.html (or 404.php, etc.). Upload this file to your site's /web directory.
Now create a plain text file and call it .htaccess . This file should contain the following line:
ErrorDocument 404 /404.html
Once this file is uploaded to your site's /web directory the server will use your custom error page.