rajeshtva's avatar

Best place to put code on hostinger/shared hosting provider?

Whenever we create a website on hostinger, there is always a public_html & DO_NOT_UPLOAD_HERE inside. but I have seen that for deploying website,

  1. some articles suggest to put code & other assets inside public_html folder while
  2. some suggests to put only publicly accessible files inside public_html & put other logic related code outside of public_folder.

but also the presence of DO_NOT_UPLOAD_HERE suggests that we should not put code inside root folder of domain and put only inside public_html.

What is best way to deploy website? & What is the purpose of DO_NOT_UPLOAD_HERE file provided by hostinger?

0 likes
3 replies
DhPandya's avatar

Generally, On the hosting public_html is a directory where you must host your code. If you're uploading Laravel projects, it already has a public folder that will protect your code from being publicly accessible. But when working with shared hosting the main issue is that they will not provide you with the root directory changing options, so either you've to move your public folder's content to public_html or you have to put .htaccess to redirect a request to your public folder, and the fact is that this ain't the best way to host. This creates vulnerability for your sites. So, if possible, consider using any cloud or dedicated hosting. There is already one thread that discussed the similar concern: https://laracasts.com/discuss/channels/tips/hosting-on-shared-server-best-practice

jlrdw's avatar

Also on many of the shared hostings, some developers want to cram five customers sites into one site, don't, Set up a single site per customer and be fair to them.

I am not saying you do this, but I have seen where some try this.

And yes main laravel should be out of web.

Definitely look at that link that @martinbean gave above.

Please or to participate in this conversation.