title: Deploying Laravel on a shared hosting sub-directory
body: <p>I'm trying to deploy laravel 5.5 inside a WordPress sub-directory on a shared hosting. I tried too many suggestions from google but I still can't make it work. It always returns a 404 error. WordPress is installed inside <code>/public_html</code>
  and I need to install Laravel on <code>/public_html/my-laravel-app</code>
  Here's what my <code>.htaccess</code> files look:</p>
  
  <p><strong>/public_html/.htaccess</strong></p>
  
  <pre><code># BEGIN WordPress
  &lt;IfModule mod_rewrite.c&gt;
  RewriteEngine On
  RewriteBase /
  RewriteRule ^index\.php$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /index.php [L]
  &lt;/IfModule&gt;
  
  # END WordPress
  
  # protect wpconfig.php
  &lt;files wp-config.php&gt;
  order allow,deny
  deny from all
  &lt;/files&gt;
  
  # protect the htaccess file
  &lt;files .htaccess&gt;
  order allow,deny
  deny from all
  &lt;/files&gt;
  
  # disable the server signature
  ServerSignature Off
  </code></pre>
  
  <p><strong>/public_html/my-laravel-app/.htaccess</strong></p>
  
  <pre><code>&lt;IfModule mod_rewrite.c&gt;
     RewriteEngine On
     RewriteBase /my-laravel-app/
     RewriteCond %{REQUEST_FILENAME} !-f
     RewriteCond %{REQUEST_FILENAME} !-d
     RewriteRule . /my-laravel-app/public/index.php [L]
  &lt;/IfModule&gt;
  </code></pre>
  
  <p><strong>/public_html/my-laravel-app/public/.htaccess</strong></p>
  
  <pre><code>&lt;IfModule mod_rewrite.c&gt;
      &lt;IfModule mod_negotiation.c&gt;
          Options -MultiViews
      &lt;/IfModule&gt;
  
      RewriteEngine On
  
      # Redirect Trailing Slashes If Not A Folder...
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ^(.*)/$ /$1 [L,R=301]
  
      # Handle Front Controller...
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteRule ^ index.php [L]
  
      # Handle Authorization Header
      RewriteCond %{HTTP:Authorization} .
      RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
  &lt;/IfModule&gt;
  </code></pre>
  
  <p><strong>/public_html/my-laravel-app/public/index.php (some part of index.php)</strong></p>
  
  <pre><code>require __DIR__.'/../bootstrap/autoload.php';
  
  /*
  |--------------------------------------------------------------------------
  | Turn On The Lights
  |--------------------------------------------------------------------------
  |
  | We need to illuminate PHP development, so let us turn on the lights.
  | This bootstraps the framework and gets it ready for use, then it
  | will load up this application so that we can run it and send
  | the responses back to the browser and delight our users.
  |
  */
  
  $app = require_once __DIR__.'/../bootstrap/app.php';
  </code></pre>