title: Laravel index route issue when using for a subsection in another fw (external public dir)
body: <p>I'm using a Laravel app with an external public directory, e.g. <code>root/Laravel</code>, and <code>root/html/public</code>.</p>
  
  <p>I need this app to load from a require on a php file (<code>root/html/this-section.php</code>) that already has another framework loading it, hence that other fw has its own head, and body tag. This app will load between the header and footer of that file.</p>
  
  <p>When I set up the routes, i notice that both of the following routes work, but i get different results. </p>
  
  <pre><code>Route::get('/', 'HomeController@index');
  Route::get('/this-section', 'HomeController@index');
  
  # this also works as a substitute for above, still same issue though
  Route::get('//', 'HomeController@index');
  </code></pre>
  
  <p>These are the same pages, the controller has the same code, I would expect that the pages load the same.  Whats happening is the main index <code>site.com/</code> is loading correctly, but the latter is loading without the html <code>&lt;head&gt;</code> and <code>&lt;body&gt;</code> tags which exist on <code>this-section.php</code>.  So essentially, the latter is not loading the parent page, its only loading what it sees on the blade templates.</p>
  
  <p>I suspect maybe either need to add a rewrite to the .htaccess to cover this, or set up a custom redirect or return of a view or response in the controller <strong>(I need help here with suggestions)</strong> where I can then make a second method, e.g. <code>thisSectionIndex()</code> and return that suggestion. </p>
  
  <p>At first I had things working with overriding the <code>public_path()</code> to the correct path <code>this-section</code> however that backfired when i made the sub routes 
  e.g. when using the following route setup </p>
  
  <pre><code>Route::get('/', 'HomeController@index');
  Route::get('/feature', 'SectionController@feature');
  </code></pre>
  
  <p>It caused the <code>feature</code> route to be 500 or 404, I think it couldn't find the files, so I realized I needed to <em>unfortunately</em> add in the <code>/this-section</code> portion to the route ,which opened a can of worms pretty much. </p>
  
  <p>Route::get('/', 'HomeController@index');
  Route::get('/this-section', 'HomeController@index');
  Route::get('/this-section/feature', 'SectionController@feature');</p>
  
  <p>ON a side note, some fallout for this which I found a temporary work-around for already, was <code>{{assets()}}</code> broke.  I had <code>assets()</code> overridden to not have to use the <code>this-section/</code> portion, e.g. like this <code>{{assets(/this-section/css/styles.css)}}</code>.  The temp worksround was to <code>unfortunately</code> have to manually add the paths and forego using <code>{{assets()}}</code> altogether in the blade templates  until i figure that part out, because no path is working for them now. </p>
  
  <p>Some background info: </p>
  
  <p>Im overriding the public path like this</p>
  
  <pre><code>#Laravel\app\SectionApplication
  class SectionApplication extends \Illuminate\Foundation\Application
  {
    public function publicPath()
    {
      $newBasePath =  $this-&gt;basePath . DIRECTORY_SEPARATOR . '..' .
        DIRECTORY_SEPARATOR . 'html/this-section';
  
      return $newBasePath;
    }
  }
  
  
  #Laravel/bootstrap/app.php
  // $app = new Illuminate\Foundation\Application(
  //     realpath(__DIR__.'/../')
  // );
  
  $app = new App\SectionApplication(
      realpath(__DIR__.'/../')
  );
  </code></pre>
  
  <p>Here is the pertinent(adjusted) parts of the laravel bootstrapper index (<code>html/this-section/index.php</code>)</p>
  
  <pre><code>function public_path($path = '')
  {
    return realpath(__DIR__);
  }
  
  //adjust your relative laravel framework path here
  $laravelRelPath = '../../Laravel';
  
  //override the blade {{asset()}} helper
  function asset($path, $secure = null)
  {
    $newPubPath = 'this-section/'; //relative from html where the index.php will be
    return app('url')-&gt;asset($newPubPath . $path, $secure);
  }
  </code></pre>
  
  <p>.htaccess is located outside of Laravel, and in <code>html/</code></p>
  
  <pre><code>&lt;IfModule mod_rewrite.c&gt;
      &lt;IfModule mod_negotiation.c&gt;
          Options -MultiViews
      &lt;/IfModule&gt;
  
      RewriteEngine On
      #Rewritebase /this-section/
      #RewriteRule ^(.*)$ this-section/$1 [L]
  
      # Redirect Trailing Slashes If Not A Folder...
      RewriteCond %{REQUEST_FILENAME} !-d
  
      # 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>