5

When I start a http server using a command:

python -m SimpleHTTPServer

How can i change the default 404 page?

1
  • 1
    If you're planning on making a web application, don't use SimpleHTTPServer. It's slow, single-threaded, and unstable under any sort of load. Commented Aug 21, 2013 at 7:35

1 Answer 1

4

With command line, it is impossible.

You should make a script like following:

import BaseHTTPServer
import SimpleHTTPServer

class MyHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
    error_message_format = '''
    custom error message
    '''

BaseHTTPServer.test(MyHandler, BaseHTTPServer.HTTPServer)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.