Laravel installation in cpanel and removing the public in url path

Laravel Installation in cpanel and removing public in url

1. Put all your Laravel stuff in the top-level folder (so that the app folder is next to the public_html folder)

2. Move all files from public to public_html (be sure to also move hidden files, such as .htaccess)

3. Delete the now empty public folder

4. Open bootstrap/paths.php

Change the public folder path as below,

 | Public Path
 | The public path contains the assets for your web application, such as
 | your JavaScript and CSS files, and also contains the primary entry
 | point for web requests into these applications from the outside.
'public' => __DIR__.'/..',

5. Check the .htaccess file is equal to below content,

 <IfModule mod_rewrite.c>
    Options +FollowSymLinks
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]

6. Open index.php file,

Change the autoload.php path, and start.php file path like below,

require __DIR__.'/bootstrap/autoload.php';
$app = require_once __DIR__.'/bootstrap/start.php';

Leave a Reply