How to deploy a slim framework API on a web host


Hi! I am building an api using slim . everything works perfectly on my local machine . However when I uploaded the files to the webhost , it doesn’t . when I hit my webhost url it lists the directories (public included) and the urls I set don’t work anymore . any tips on how to deploy it correctly? Thank you!


There are quite a few possibilities. Since you see the public directory itself, that leads me to believe everything could have been uploaded a directory down from your site’s document root. Also, if you are using a .htaccess file then you need to be sure that file and any other potentially “hidden” files are uploaded. Otherwise, can you describe your setup a bit?


Thank you for the tip . everything is fixed now ! I added a .htaccess file in the root directory of the slim framework project with this content

RewriteEngine on
RewriteRule ^$ public/ [L]
RewriteRule (.*) public/$1 [L]


Hi azzenovic,

i am also getting the same problem can you please tell me the steps how can you fix the problem.


@rohit more information would be helpful. What have you tried and what is happening? Are you getting any error messages in either the browser or your server’s log?