Well, there are two ways...
1st in cpanel search for "Installatron Applications Installer" or somekind of app installer :)
In installatron app installer screen on right top find "Applications Browser" from there search for Laravel and install it by choosing your domain(If you have more than one domain)
After installation copy and replace your local files with the remote files.
2nd second way, .zip your local laravel folder. And upload your files to your server, and then extract the files.
NOW FROM HERE IT'S THE SAME FOR BOTH WAYS->
"public" directory in laravel project will be in the root of your remote server(root folder for your domain, If you have addon domains for ex. public_html/example.com then "public" folder should be in that example.com)
make another folder and put all other laravel files and folders in that folder.
open and edit /public/index.php
change these two lines->
require DIR.'/../vendor/autoload.php';
app = require_once DIR.'/../bootstrap/app.php';
to reflect the file structure in your server.
For ex. if "public" folder is in the same directory with "vendor" and "bootstrap" remove /..
- Edit your .env file pay attention to database credentials.
PS: do not change database host address it should remain same.
AND FINALLY the .htaccess files
you need to have two .htaccess files
one in "public" directory content like this->
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
Second .htaccess file will be in the root folder of the domain with content->
RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]
ONE PROBLEM YOU MIGHT COME ACCROSS if php version problem stating that composer dependencies version is php7.xx bla bla
If this happens go to cpanel again and search for "Select PHP Version"
From there change your current PHP version to suit with the PHP version you get in the error. And you need to click "Set as current"!
That's it :)
yoursite.com/public
, btw that bad way to host all your laravel project to your public folder, anyone can access your.env
and all your backend script – Rap Sherlock.env
file and can see your DB username and password – Rap Sherlock