title: .htaccess silent root to subdirectory remap
body: <p>I need to remap all root domain requests to a subfolder silently except <code>/user/</code> and <code>/admin/</code>. I have custom code under my root domain and want to install WordPress additionally which should be also available under the root domain. </p>
  
  <p>My htaccess looks like this:</p>
  
  <pre><code>Options FollowSymLinks
  
  RewriteEngine On
  RewriteBase /
  
  SetEnvIf Request_URI  ^(.*)$       section=public
  SetEnvIf Request_URI  ^/user/.*$   section=user
  SetEnvIf Request_URI  ^/admin/.*$  section=admin
  
  # Link to WordPress
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{ENV:section} public
  
  # ... How do I map to a subdirectory from here? ... #
  </code></pre>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I came accross the following code which is working almost like I need it, but if the file does not exists in wordpress, it repoints back to my code.</p>
  
  <pre><code># Link public to WordPress
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{ENV:section} public
  RewriteCond %{REQUEST_URI} !^/wordpress/
  RewriteRule ^(.*)$ /wordpress/$1
  
  # Link public to WordPress root folder
  RewriteCond %{ENV:section} public
  RewriteRule ^(/)?$ wordpress/index.php [L]
  </code></pre>