HTTP 501 Not Implemented
5xx Server Error
- Home
- HTTP Status Codes
- 5xx
- 501
What is HTTP 501 Not Implemented?
The 501 (Not Implemented) status code indicates that the server does not support the functionality required to fulfill the request. This is the appropriate response when the server does not recognize the request method and is not capable of supporting it for any resource.
Common Use Cases
- Unsupported HTTP methods
- Server missing required functionality
- Legacy servers receiving modern request features
Usage Example
If your server only supports GET and POST methods and receives a PATCH request, return 501 Not Implemented. This tells the client that the server intentionally does not support this HTTP method for any resource, unlike 405 which would indicate the method is known but not allowed on the specific endpoint.
// PHP - returning 501 for unsupported methods
$method = $_SERVER['REQUEST_METHOD'];
if (!in_array($method, ['GET', 'POST'])) {
http_response_code(501);
echo json_encode(['error' => "Method $method not implemented"]);
exit;
}
Related Status Codes
Common Mistakes
Mistake: Using 501 instead of 405 for endpoints that do not support a method
Fix: Use 405 Method Not Allowed when the server supports the method in general but not for the specific endpoint. Use 501 when the server does not implement the method at all.