Follow these given steps
- Create new project in laravel framework as mention in laravel documentation
- make sure you have created a project as you want to run online server.
- don’t forget to take backup of your database, if you are using application with database.
- zip all laravel project files together.
- login to your cpanel shared hosting.
- make sure are at public_html directory.
- upload created zipped files.
- now unzip the files here.
- as we know shared hosting always looking for index.php that is available at public folder in laravel.
- so we will redirect request to public folder using .htaccess file.
- make sure you have .htaccess file at project root, if not please create it. sometimes it is available but not accessible that is hidden, if it is, just go to setting button that is placed at top right side and check show hidden files.
- after this just copy this given line of code at .htaccess file
<IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^(.*)$ public/$1 [L] </IfModule>