Slim PHP Framework API - http statuscodes not changing

98 Views Asked by At

I have recently started using Slim to make an API but I have been unsuccessful in all my attempts. My main problem is that I am not able to set the HTTP status code using the withStatus method on the Response object. I always receive a 200 OK when I test with Postman and browser.

I seem to have figured out where the problem might be. In my project, I have my web application which is done without any frameworks in the root. I also have an API built using slim in a subdirectory /api/v1/index.php. When I tested with the slim API in the root, the status codes seem to be changing according to what I set. This leads me to believe that the issue is with me putting the API in a subfolder.

Is there anyway I can edit the .htaccess or apache config to send http codes from my slim application rather than my apache server which seems to be overriding my status code to 200 OK?

0

There are 0 best solutions below