Laravel : Install laravel 4 on a shared host

I have been trying to figure out to install Laravel 4 on a shared hosting, but there was not enough information available for this, so I talked with people in Laravel IRC and install the Laravel 4 on a shared hosting by only exposing public content and hiding application files.

Normally on Linux shared hosting we have following directory structure


|- accesss-logs

|- etc

|- public_ftp

|- public_html

|- www

Whatever we save under public_html folder becomes available for world. In the Laravel documentation it has been mentioned that we should upload application files outside public folder.

Note: Laravel is designed to protect your application code, and local storage by placing only files that are necessarily public in the public folder. It is recommended that you either set the public folder as your site’s documentRoot (also known as a web root) or to place the contents of public into your site’s root directory and place all of Laravel’s other files outside the web root.

So, now cut paste all the contents of public folder in the root of your application, If you are working on Xampp your path will be

Now we need to upload all these files on server, for this create a folder

say your folder name is “your-application”, after this upload app, bootstrap, packages, vendor in this directory. Now upload all remaining files in

So far so good, the only remaining task is to change the paths, open index.php files under


We need to change the path in one more file to configure public folder path. Now open a file in


Since, we have pasted all our files in public folder in this directory, we are mentioning this path to locate public files of our application.

that’s it, now open this in your browser and you will see the default welcome page.

  • David Sandy

    Thanks! Excellent guide – just what I needed! 🙂

    • Devendra Verma

      I’m glad to hear that:)

    • Devendra Verma

      I’m glad to hear that 🙂

      • Alex

        Hello and thanks for your tutorial. I can’t make it work. can you help me please?
        I made an new folder named laravelr and there i putt all files without public folder
        i made an subdomain from cpanel named laravel and there i put all files from publix folder so i have like this:
        /home2/alexgs/public_html/laravel full path
        /home2/alexgs/ here i made laravelr
        /home2/alexgs/laravelr all files without public folder

        /home2/alexgs/public_html/laravel only filed from public folder

        in index.php from laravel

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

        in path from laravelr

        ‘public’ => __DIR__.’/../../public_html/laravel’,

        and when i visit my site i have

        Warning: require(/home2/alexgs/public_html/laravel/../laravelr/bootstrap/autoload.php): failed to open stream: No such file or directory in /home2/alexgs/public_html/laravel/index.php on line 21

        • Devendra Verma

          Sorry Alex, i couldn’t help you at that time, hope you have resolved the problem, If you need any further help on this, let me know 🙂

  • Ameen

    Thanks, worked fine with me.

  • Fahad M Rafiq

    Well, I prefer Dedicated hosting for laravel. Cloudways seems much better for this. Their platform integrated with Google Cloud Hosting, Amazon Cloud and Digital Ocean.

    Server Features

    1- 15 real time monitoring features.
    2- Vertical Server Scaling
    3- Service Management (Nginx, Varnish, MySQL, Apache, Memcache…)
    4- Advance Server settings (Upload size, execution limit, memory limit etc.)
    5- SSL Certificate Configuration
    6- Automatic Backups
    7- Server Addons (Email settings)
    8- Dedicated IP
    9- Unlimited Domains
    10- Unlimited Application Installations