100% working way Best Way to Deploying LARAVEL Project on Shared Hosting – Best Way to Host Laravel Website on Shared Hosting
I am back again with some new hacks. Yesterday I was wondering how to host simple LARAVEL application on shared hosting? And guess what I found a solution.
Let’s get started.
First of all let’s understand how LARAVEL app started, from public folder->index.php, right?
Now our first step is getting that index.php file to your Laravel root directory folder. You can find this 2 lines in your index.php file.
require __DIR__ . '/../bootstrap/autoload.php'; $app = require_once __DIR__ . '/../bootstrap/app.php';
Change this both line to
require 'bootstrap/autoload.php'; $app = 'bootstrap/app.php';
And one more step is to get your .htaccess file from public folder to your Laravel root directory folder.
SO our Folder structure looks like this
And Done. Your Laravel project setup is completed for uploading in shared hosting.
Now One thing is to need to understand which is your assets. Add your css and js as you add in laravel before but now add “/public” in your asset URL.
Now one another question is how you can upload the vendor folder which contains more than 10000+ files. So here is the simple solution to make full LARAVEL Project ZIP file and extract it on your shared hosting panel.