How can I make custom 404 pages?

I’d like to serve my own HTML for 404 (and other HTTP codes).

You will have to include lines for handling 404 response codes in your application code. In a Python web framework like Django, include it in a views.py file.

from django.shortcuts import render_to_response
from django.template import RequestContext


def handler404(request, exception, template_name="404/index.html"):
    response = render_to_response("404/index.html")
    response.status_code = 404
    return response

and then update urls.py:

handler404 = 'my_app.views.handler404'

(Source)

In PHP you can include it in your main passthru file in the application directory, index.php. Within that file, you can then point to the custom 404 html file:

http_response_code(404);
readfile("404/index.html");