3 ms·
Isn't this something that the http server handles? I am not in web development except for basic php and cgi scripts. Are people actually writing web app code to
by aninteger 15y ago
Isn't this something that the http server handles? I am not in web development except for basic php and cgi scripts. Are people actually writing web app code to dictate what http code comes back on each request?
- politician 15y agoYes, sometimes the correct response is not an HTML page, but an error code (e.g. 301 Moved Permanently, 302 Found are used to implement redirects).
- ataggart 15y agoAnd sometimes the correct response is an error code and an HTML page, e.g., 401 Unauthorized and an ajax login page that reloads the current URL.
- vdm 15y agoA correct response code is the minimum to play nice, and a body, HTML or otherwise, is courteous. They are not mutually exclusive. http://php.net/manual/en/function.header.php http://php.net/manual/en/function.header.php http://docstore.mik.ua/orelly/linux/cgi/ch03_03.htm#ch03-9-fm2xml http://docstore.mik.ua/orelly/linux/cgi/ch03_03.htm#ch03-9-f...
- mikeryan 15y agoYou see more explicit use of http status codes in web service (data) API's particularly ones using REST.