[thelist] Correct 'Bad Request/Malformed Request' HTTP Error Code

Jens Brueckmann jens.brueckmann at gmail.com
Sat Jul 23 06:54:43 CDT 2005

2005/7/23, Burhan Khalid <thelist at meidomus.com>:

>    For example, say a valid request is
>    file.ext?op=beta
>    and someone requests file.ext?op=lalalala
>    I want to send out 400 Bad Request (is this the right response?)

I would rather say this is not a 'Bad Request', as the syntax and URI are valid.
As no corresponding page is available for this request, it is a plain
'Not Found' error.

More on status codes see

> how would I actually send that out?  Using PHP, you can write custom
> headers using the header() function, and at first glance, this would
> seem like :
>    header('Bad Request',true,400);

No. The correct expression is something like:

 header("HTTP/1.1 400 Bad Request");

or rather:

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

More information about the header() function is available at



Jens Brueckmann

More information about the thelist mailing list