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
RewriteRule ^$ public/ [L]
RewriteRule (.*) public/$1 [L]
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?
I think this may help?
Your domain should point directly to the public directory (whatever that may be).
So, if it’s a private server you can do that with apache or nginx. If not and you have /var/www/site.com/html or whatever it is, then you would have
/var/www/site.com/ all of your app dirs
and the contents of your public folder would go in the html folder that would be served.
All that to say, you upload one directory above your site root and public contents goes in the site root.