I have a multiple GET, POST and PUT routes declared in my Slim v2 App and the API had been working perfectly until today. Out of 2 POST routes, the first one declared is returning a 404 Not Found error. This only happens when I call the API on my GoDaddy hosting; when I test it on my localhost it works fine. This is so weird I have ran out of ideas on how to debug this problem. I am using Postman to execute and test the calls to both of servers, local and GoDaddy. Also, the calls to the GoDaddy hosted API are done via HTTPS. My .htaccess file on both servers looks like this:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L,QSA]
RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
When doing a POST
request to /apifolder/v1/addcheckin
server responds with 301 redirect to which causes the client to make a GET
request to /apifolder/v1/addcheckin
. Since there is no such GET route defined server responds with 404 error.
$ curl -i -X POST https://myurl.com/apifolder/v1/addcheckin
HTTP/1.1 301 Moved Permanently
Date: Sun, 26 Feb 2017 02:26:34 GMT
Location: https://myurl.com/apifolder/v1/addcheckin
Check the middleware and the rest of the code to see what causes the 301 redirect.