title: Route All Requests to Subfolder htaccess
body: <p>I'm building an application for broad distribution and I want to change the way it's routed so that all the files can exist in the document root but still be secure as if they were above the doc root.</p>
  
  <p>The ideal set up would be to house the application folder above the docroot like so:</p>
  
  <pre><code>/home
  /---/username
  /---/---&gt;application
  /---/---/---&gt;all application files
  /---/---&gt;public_html
  /---/---/---&gt;all public files
  </code></pre>
  
  <p>But I know this isn't ideal for all potential users of my app, so I'd prefer to move this to a structure like so:</p>
  
  <pre><code>/home
  /---/username
  /---/---&gt;public_html
  /---/---/---&gt;application
  /---/---/---/---&gt;all application files
  /---/---/---&gt;public
  /---/---/---/--&gt;all public files
  </code></pre>
  
  <p>Basically just putting everything within the doc root, forbidding access to the application directory, and routing all requests to the public folder, so that we can get the same security of having files above the doc root, but making it simpler for those that may not want this type of set up for their shared hosts.</p>
  
  <p>I was thinking of using an include inside <code>public_html/index.php</code> that would include <code>public_html/public/index.php</code> but I can't seem to get that to work.</p>
  
  <p>Any help would be appreciated.</p>