Support the ongoing development of Laravel.io →
Installation Configuration
Last updated 2 years ago.
0

there is nothing special to do when deploying on a subdomain. a subdomain is just a domain pointing to a folder (laravel's public folder) on your server.

0

Lets say you have domain www.domain.com (any name you call your domain) and you would like to have subdomain (any name you like) subdomain.domain.com for your laravel application.

Supose your structure on server is:

domain.com/
|-- subdomain_core
|-- [some others folders...]
|-- public_html/
|   |-- [some others folders...]
|   |-- subdomain/

subdomain_core and subdomain folders are empty.

Your have fresh laravel 5 application called laravel, what is ready to upload to server.

In laravel folder open public/index.php file and change
require DIR.'/../bootstrap/autoload.php';
to
require DIR.'/../../subdomain_core/bootstrap/autoload.php';

$app = require_once DIR.'/../bootstrap/app.php';
to
$app = require_once DIR.'/../../subdomain_core/bootstrap/app.php';

Then open bootstrap/app.php file and change
realpath(DIR.'/../')
to
realpath(DIR.'/../../subdomain_core/')

Then open bootstrap/autoload.php file and change
require DIR.'/../vendor/autoload.php';
to
require DIR.'/../../subdomain_core/vendor/autoload.php';

$compiledPath = DIR.'/cache/compiled.php';
to
$compiledPath = DIR.'/../subdomain_core/cache/compiled.php';

So all files and folders what is in your laravel application folder should go to subdomain_core folder except public folder. All public folder content should go to subdomain folder.

If on your server settle to use your subdomain, type subdomain.domain.com in your browser and thats it.

Last updated 8 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.