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
Feb 8, 2024
3
Level 4
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,
- some articles suggest to put code & other assets inside
public_htmlfolder while - some suggests to put only publicly accessible files inside
public_html& put other logic related code outside ofpublic_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?
Please or to participate in this conversation.