Shahzad Fateh Ali
Shahzad Fateh Ali

Reputation: 724

Laravel 5 directory structure on shared hosting

I am new to Laravel and started learning v5 few months back. I have created a sample application and want to deploy it over production (Shared hosting).

The easiest way for me is to put all content including app, vendor, config, tests etc folders directly to public_html but I don't want to do this. I want to keep laravel specific things outside the public_html and put only content from public folder to this directory.

What are the options available to do this?

Also, can I share same laravel installation for multiple applications?

Upvotes: 1

Views: 1015

Answers (2)

Pyton
Pyton

Reputation: 1319

on public/index.php add after

$app = require_once __DIR__.'/../bootstrap/app.php';

this:

$app->bind('path.public', function() {
    return __DIR__;
});

Now You can change public directory to public_html

Upvotes: 1

nCrazed
nCrazed

Reputation: 1035

Keep your code outside of the public_html and create a symbolic link from public_html to the public directory in your laravel directory.

Upvotes: 0

Related Questions