First, upload laravel project to /home/account_name/project_name, not public_html.
Then, Move /home/account_name/project_name/public contents to public_html.
Edit this 2 line of code public_html/index.php from
require __DIR__.'/vendor/autoload.php';
$app = require_once __DIR__.'/bootstrap/app.php';
to
require __DIR__.'/../project_name/vendor/autoload.php';
$app = require_once __DIR__.'/../project_name/bootstrap/app.php';
and add this code in public_html/index.php
$app->bind('path.public', function() {
return __DIR__;
});
After that, replace public_html/.htaccess with
<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}]
#RewriteRule ^(.*)/$public / [L,R=301]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php73” package as the default “PHP” programming language.
<IfModule mime_module>
AddHandler application/x-httpd-ea-php73 .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit
And edit project_name/server.php from
if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) {
return false;
}
require_once __DIR__.'/public/index.php';
to
if ($uri !== '/' && file_exists(__DIR__.'/../public_html'.$uri)) {
return false;
}
require_once __DIR__.'/../public_html/index.php';
And the last, check your PHP version in cpanel.
I used php7.3 as described above in .htaccess.
Well. I hope this will help you.