Take the 2-minute tour ×

Say I'm sending some HTTP status code in PHP, do I actually need to do

header('HTTP/1.1 301 Moved Permanently');

or is it enough to

header('HTTP/1.1 301 FooBar');

I once did this in a quick and dirty reverse proxy, where I could only get the code, not the message, from a CURL response and sent it back with FooBar as message. This appeared to work fine.

share|improve this question

1 Answer 1

up vote 7 down vote accepted

Via the spec:

The individual values of the numeric status codes defined for HTTP/1.1, and an example set of corresponding Reason-Phrase's, are presented below. The reason phrases listed here are only recommendations -- they MAY be replaced by local equivalents without affecting the protocol.

share|improve this answer

Your Answer


