Laravel Remove Public From Url in Shared Hosting
While deploying laravel in shared hosting, we see public at the end of website. That's why it seems bad while visiting website. Laravel mainly starts its execution from public path. After uploading the whole project in public_html or www directory, all folders are are placed inside root directory. Due to missing of index.php inside root directory, site is not visible to public. That's why we need to redirect all requests to public path after visiting the site example.com.
That's why we need to create a .htaccess file at the root directory. Let's do this
Create .htaccess file at root directory of the project and place below 3 lines
Save the file and visit your site now in browser
RewriteEngine on RewriteCond %{REQUEST_URI} !^public RewriteRule ^(.*)$ public/$1 [L]
.htaccess file
Project file list with .htaccess
After placing, save this file and visit your site https://example.com; Now you are good to go