How to deploy laravel project on cpanel or shared hosting
Share this:
Step #1
Zip your laravel project files
Step #2
Upload it to the root document "public_html" folder
Step #3
Unzip the zip file to the public_html and make sure all your laravel project files are on the "public_html" directory
Step #4
Create a .htaccess file in your "public_html" directory then copy the below code and save it
<IfModule mod_rewrite.c>
RewriteEngine On
# Redirect all requests to the public folder
RewriteRule ^(.*)$ public/$1 [L]
# Deny access to all directories except public
RewriteRule ^(app|bootstrap|config|database|resources|routes|storage|tests|vendor)/(.*)$ - [R=404,L]
# Deny access to sensitive files
RewriteRule ^(\.env|\.log|\.git|composer\.(json|lock)|artisan|phpunit\.xml)$ - [R=404,L]
</IfModule>
Step #5
Now browse your website you should see your laravel project live