title: .htaccess for subfolder
body: <p>I have the following structure </p>
  
  <pre><code>-www
    \-subfolder
  </code></pre>
  
  <p>In <code>www</code> I have my main site's <code>index.php</code>.</p>
  
  <p>In subfolder I have a sort of admin UI and in there I'd like to have another <code>index.php</code> for the admin UI. </p>
  
  <p>Currently my requests from within <code>/subfolder/index.php</code> get redirected to <code>www/index.php</code> and basically the pages of my admin UI don't show up.</p>
  
  <p>This is my <code>.htaccess</code> file:</p>
  
  <pre><code>RewriteEngine On
  RewriteRule ^$ index.php [QSA,L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)/(.*)$ index.php?lang=$1&amp;page=$2 [L]
  </code></pre>
  
  <p>Can you help me? I've tried several options in other answers but as I'm no so advanced a web developer, I couldn't get any to work.</p>
  
  <hr>
  
  <p>@TerryE, Sorry if I have come off as crude.</p>
  
  <p>I am using a local setup for testing. 
  I have installed Vertrigo server, which gives me Apache server.Running on Windows7 OS. The server is installed in Program files\VertrigoServ\Apache folder.</p>
  
  <p>My public folder is www. In there I have my main  site definition.  . The site is accessed locally via <code>127.0.0.1/index.php</code> or <code>127.0.0.1/</code></p>
  
  <p>I have site localization so URLs are constructed as <code>/$lang/$page</code>  e.g. <code>&lt;a href=" / &lt;?php echo $lang; ?&gt; / home "&gt; HOME &lt;/a&gt;</code></p>
  
  <p>In <code>index.php</code> of main site I have the following:</p>
  
  <pre><code>$page = trim( ( isset( $_GET[ 'page' ] ) ? $_GET[ 'page' ] : 'home' ), '/' );
  
  $lang = trim( ( isset( $_GET[ 'lang' ] ) ? $_GET[ 'lang' ] : 'en' ), '/' );
  $langs = array( 'en', 'fr', 'ru' ); 
  </code></pre>
  
  <p>And upon this data I get to open the pages this way:</p>
  
  <pre><code>include 'html/'. $lang . '/' . $page . '.php';
  </code></pre>
  
  <p>All my main site's pages lie in <code>www/html/$lang/</code></p>
  
  <p><code>$_SERVER['REQUEST_URI'])</code> gives <code>/en/home</code> for page HOME.</p>
  
  <p><code>127.0.0.1/en/home</code> WORKS</p>
  
  <h2>All navigation works perfectly for the main site.</h2>
  
  <p>However I have created an admin UI which lies in folder www/admin - one level below in www. </p>
  
  <p>And in there I don't have any localization. I just have EN as language. 
  So at the top of the index.php in admin folder I have again </p>
  
  <pre><code>$page = trim( ( isset( $_GET[ 'page' ] ) ? $_GET[ 'page' ] : 'home' ), '/' );
  </code></pre>
  
  <p>However, here navigation is as follows <code>&lt;a href=/admin/home"&gt; HOME &lt;/a&gt;</code></p>
  
  <p>and upon this I get to construct the pages in the index.php in admin folder as follows: </p>
  
  <pre><code>include 'html/ . $page . '.php';
  </code></pre>
  
  <p>the pages lie in <code>www/admin/html</code></p>
  
  <p>This does not work at all. Whenever I press home link in admin UI, I get redirected to my main site (non-existing page).  If I add <code>RewriteRule ^subfolder/ - [L]</code> in .htaccess, I get <code>HTTP 404 NOT Found error</code>. </p>
  
  <p><code>127.0.0.1/admin/home</code> DOES NOT WORK. Neither does any other navigation from within admin. Thank you for your willingness and patience to help me!</p>