How to deploy a slim framework API on a web host


#1

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!


#2

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?


#3

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]


#4

Hi azzenovic,

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


#5

@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?