Host Laravel project on cPanel
Step 1:-
First of all, we have to get all the files & directories into laravel_project folder. open your terminal & go inside your project folder, And run the command php artisan cache:clear. to clear your cache.
then run php artisan config:clear to clear the cached version of your config file, if there is any.
Now make a zip folder of your project’s folder for ex. Laravel_project
Step 2 : – Upload your folder
After login to your cPanel, for uploading folder go to File Manager, & upload your folder in root directory, i have created laravel_project folder in root directory.
Step 3:-
Unzip (your project’s folder)laravel_project open laravel_project folder and move all the public folder content into public_html directory. so make sure that, you do not have to keep anything in public folder, it should be blank.
Step 4 :-
keep .htaccess file into public_html & into (your created folder)laravel_project that is outside the public_html. Or copy .htaccess file from public folder & paste it into laravel_project.
Step 5:-
And Edit index.php file like following way add laravel_project name before /vendor.
Step 6:-
If you have dynamic work done into your project then create database connectivity through your .env file that will be available into laravel_project folder if it is not shown then click on settings on right corner of cPanel on the Preferences window, enable the checkbox show hidden files(dotfiles).
If you do not know how to make database connectivity then please refer this link https://mediastroke.com/blog/deploy-dynamic-java-project-on-java-hosting/
Step 7:-
At the end run your domain on the browser. Like
Leave a Reply