Search code examples
phplaravelstoragehostingshared-hosting

Laravel How to setup a public_html folder in a shared hosting in hostinger


I'm trying to host a Laravel project in a shared hosting using Hostinger and I am having problems with the assets. The sample folder is here sample folder, I'm not really sure on how to make this connection with my public folder and resources folder. I've already use php artisan storage:link before I uploaded the project.


Solution

  • I assume you don't have shell access in your shared hosting account.

    One way to do this is to create a temporal route that runs the artisan command.

    Firstly, before you upload, delete the existing storage link from public

    rm public/storage

    Route::get('create-symlink', function (){
        Artisan::call('storage:link');
        return response('Done...');
    });
    

    Remeber to remove or comment out the route when done.