• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Status codes do not match, help to understand this.

Good day!
I had a question:
I noticed that when going to a non-existent page, I was thrown to the one that is set in "$routes->set404Override();" and it's right, but in the http response when using the method "$this->response->getStatusCode()" on the screen displays an error "200" what is logically not true, it should be ?
I would change this world, but God doesn't give me the source.

If the controller set to override a 404 is catching it, then it's not a 404 code until that controller says it is. The intention here is that it gives you chance to perform any other actions when a page cannot be found. This might be as simple as a 404 page, or one that provides suggestions for pages they might have been looking for, or even the ability to map URI's to files that represent a valid HTML page. You can be pretty creative with it's uses here. In all 3 of those examples, it returns a valid page so 404 is not valid. It's up to your override controller to determine the status code to present.

Thank you for clarification !
As I understand it, the error page, you need to develop yourself, for example "ErrorsController.php" in which when you use the class "Response" can be mapped to status codes with the methods, or all the same it is done a little differently ?!
I would change this world, but God doesn't give me the source.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.