Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm testing client software which responds differently depending on a webserver's response code.

For the purposes of testing, I need to configure my Apache server to return specific error codes, such as 500, 403, and many others.

I don't want to have to produce the condition for each error code, I just want to return the error code to the browser/client for testing.

Hopefully the syntax is simple such as the case of a redirect:

Redirect 303 /two

But in theory I would like something like this:

Redirect 500 /test /test2

Does anybody know how to do this?


share|improve this question
up vote 0 down vote accepted

Why not use a PHP-header to do this?

header("HTTP/1.0 404 Not Found");

Will simply return a 404 error. has a list of all available error headers.

The reason you'd not be getting a page saying "404 - not found" would be that the server itself isn't sending one while the web browser knows it exists (After all, the server is replying with 404). The web browser WILL be receiving the correct error code and detect it though.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .