I'm working on an PHP and MySQL based IP block system that is supposed to block all user agents from specific countries. Which status code should I use if an agent is blocked?
EDIT: I'll elaborate just a little more: I'm concerned about how search engines such as Google might react to it. Is there a possibility that a same search engine might crawl a page two times and get conflicting statuses on both occasions? Are, say, Google bots always "American?"
A 444 No Response error indicates that the server has closed the connection with no returned information from a client request.
The 403 (Forbidden) status code indicates that the server understood the request but refuses to authorize it. A server that wishes to make public why the request has been forbidden can describe that reason in the response payload (if any).
The HTTP 201 Created success status response code indicates that the request has succeeded and has led to the creation of a resource.
The HTTP 200 OK success status response code indicates that the request has succeeded. A 200 response is cacheable by default. The meaning of a success depends on the HTTP request method: GET : The resource has been fetched and is transmitted in the message body.
For future reference, here's a big list: http://www.restapitutorial.com/httpstatuscodes.html
I'd say you can just do:
http_response_code(403);
403 is the error for forbidden.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With