To deploy a Laravel app on your Ecenica web hosting account you can follow these general steps:

  1. Log in to your cPanel.
  2. Ensure your account PHP version is set to the PHP version your Laravel app requires. See How to change PHP version
  3. From cPanel, open the Terminal or use SSH Access to gain shell access to your account.
  4. Navigate to the web directory of your domain. This is typically the public_html folder for the primary domain, or a sub-folder for addon domains.
  5. Remove all existing files and directories in the web folder to avoid git ‘existing files’ errors.
  6. Clone your Laravel project. For example, we will clone the base Laravel project repository using the Git command below. But you’d use your own repository, whether it’s on Github or Bitbucket. Alternatively you can upload your Laravel app using FTP or the cPanel File Manager.
    git clone .
  7. Install the project dependencies using the Composer command:
        composer install --no-dev
  8. Create a new MySQL database in your cPanel account.
  9. Navigate back to your Laravel project directory, copy the .env.example file to .env and update the database credentials in the file:
        cp .env.example .env
        nano .env
  10. Generate a new application key using the following command:
        php artisan key:generate
  11. Migrate the database using the following command:
        php artisan migrate
  12. Create a .htaccess file in your project directory and add the following lines to strip /public/ from the URL:
    <ifmodule mod_rewrite.c>
    </ifmodule><ifmodule mod_negotiation.c>
        Options -MultiViews
    RewriteEngine On
    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteCond %{REQUEST_FILENAME} -d [OR]
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule ^ ^$1 [N]
    RewriteCond %{REQUEST_URI} (\.\w+$) [NC]
    RewriteRule ^(.*)$ public/$1
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php
  13. Create a file index.php at the project directory root to point traffic to /public/:
     * Laravel - A PHP Framework For Web Artisans
     * @package  Laravel
     * @author   Taylor Otwell <>
    $uri = urldecode(
        parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
    // This file allows us to emulate Apache's "mod_rewrite" functionality from the
    // built-in PHP web server. This provides a convenient way to test a Laravel
    // application without having installed a "real" web server software here.
    /*if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) {
        return false;
    require_once __DIR__.'/public/index.php';

That’s it! Your Laravel app should now be successfully deployed on your Ecenica web hosting account.