title: Run laravel project in a directory folder on shared hosting
body: <blockquote>
    <p><strong>My question is:</strong> How can i run a laravel application in a directory
    (not in root) on a shared webhosting?</p>
  </blockquote>
  
  <p>For some of my clients I run Laravel applications in the root folder of their selected shared webhosting and remove the <strong>/public</strong> part from the URL. To make this work i move the index.php to the root folder and change the information from the index.php to:</p>
  
  <pre><code>require __DIR__.'/bootstrap/autoload.php';
  $app = require_once __DIR__.'/bootstrap/app.php';
  </code></pre>
  
  <p>Now i know that this can cause security problems but I already have found solutions to that case for shared webhosters.</p>
  
  <blockquote>
    <p><strong>The .htaccess i use to make this change is:</strong></p>
  </blockquote>
  
  <pre><code>RewriteEngine On
  
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)/$ /$1 [L,R=301]
  
  RewriteCond %{REQUEST_URI} !(\.eot|\.woff|\.css|\.js|\.png|\.jpg|\.gif|robots\.txt)$ [NC]
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^ index.php [L]
  
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_URI} !^/public/
  RewriteRule ^(.*)$ public/$1/$2 [L,NC]
  </code></pre>
  
  <p>But in this case i want the laravel project to  be run in a directory called test.</p>
  
  <blockquote>
    <p><strong>Folder structure:</strong></p>
  </blockquote>
  
  <pre><code>root (public_html)
    |-- test (directory with laravel project)
  </code></pre>
  
  <p>Now I'm not sure if i can simply change the .htaccess as i'm not very skilled with .htaccess files. What changes do i have to make, to make this work?</p>
  
  <blockquote>
    <p><strong>Note my urls:</strong></p>
  </blockquote>
  
  <pre><code>// this link will be changed to:
      www.[text-placeholder].com/test/public/css/style.css 
  
  // Output above result now:
      www.[text-placeholder].com/public/css/style.css
  
  // But should be:
      www.[text-placeholder].com/test/public/css/style.css 
  </code></pre>