-
Assume that you have file structure something like this:-
1
/home/username/public_html
-
Create new folder outside public_html:-
1
/home/username/main-laravel
- Move all the main file of Laravel (app, boostrap, vendor, composer.json, composer.lock, phpunit.xml etc) into that folder (step 1) except Public folder
-
Open
/home/username/main-laravel/bootstrap/paths.php
and edit to look like this:-- replace
'app' => __DIR__.'/../app',
to'app' => __DIR__.'/../../main-laravel/app',
- replace
'public' => __DIR__.'/../public',
to'public' => __DIR__.'/../../public_html/laravel',
- replace
'base' => __DIR__.'/..',
to'base' => __DIR__.'/../../main-laravel',
- replace
'storage' => __DIR__.'/../app/storage',
to'storage' => __DIR__.'/../../main-laravel/app/storage',
Then SAVE
- replace
-
Now create a new folder inside public_html
1
/home/username/public_html/laravel
- Now, move all the content in public folder of Laravel into that folder (step 4)
-
Open
/home/username/public_html/laravel/index.php
and edit to look like this:-- replace
require __DIR__.'/../bootstrap/autoload.php';
torequire __DIR__.'/../../main-laravel/bootstrap/autoload.php';
- replace
$app = require_once __DIR__.'/../bootstrap/start.php';
to$app = require_once __DIR__.'/../../main-laravel/bootstrap/start.php';
Then SAVE
- replace
-
Now create
.htaccess
in/home/username/public_html
and insert this code:-1 2 3
RewriteEngine on RewriteCond %{REQUEST_URI} !^laravel RewriteRule ^(.*)$ laravel/$1 [L]
Then SAVE