Slim framework showing 404 error, please help

hello, im new to slim, i recently created a rest api with slim. It works well on my localhost, but when i moved it to a live server and tried to access the functions, it shows a 404 not found error… i dont know how to trouble shoot, pls help…

The most likely cause is that you haven’t configured your production server to point to the front controller. For example if you are using Apache, make sure the (often hidden) .htaccecss file got copied up to the live server.

hello,

this is how my htaccess file looks like on the web server, is it correct?

RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ %{ENV:BASE}index.php [QSA,L]

Assuming you are using Apache, is the AllowOverride set to allow the .htaccess?

Also is your DocumentRoot the same in production as it is locally?

i dont know how to set document root…can u pls tell me which file it is in? is it through the htacess? ive been searching…

In other words make sure that if locally your index.php file is in /public but your production server is setup with index.php in /public_html you will likely want to adjust your local server’s vhost setup to use a DocumentRoot that matches your server.

okay thanks, i really appreciate, everything seems to be found there…
but do you think it could be routing? I read that if the application does not find a route matching the URI then it returns 404. How can i check if my routing is okay? thanks…

If the routing works locally it should work in production… doesn’t seem likely if it works locally. I’d also check your server log files to help figure out what you are hitting.

okay…thanks… one more please…:sweat_smile: what could be the issue if a particular set of functions work, and some dont. eg my login and register function shows 404, but a function callled task works, and yet all are in the place…do you have any idea what the issue might be?

Hard to say without seeing some code.