title: Apache Rewrite: show files from two directories in the same directory
body: <p>I need to access files from two directories in the same directory in a browser.</p>
  
  <p>Visually the directories may look like this:</p>
  
  <p><strong>/public_html/www.example.com/xml/</strong></p>
  
  <p><strong>/xml/</strong></p>
  
  <p><strong>/public_html/.htaccess</strong></p>
  
  <p>Important clarification: this setup supports multiple domains.</p>
  
  <p><strong>/public_html/www.example1.com/</strong></p>
  
  <p><strong>/public_html/www.example2.com/</strong></p>
  
  <p>The XML files requested at <strong><a href="http://www.example.com/xml/" rel="nofollow noreferrer">http://www.example.com/xml/</a></strong> are located at <strong>/public_html/www.example.com/xml/</strong> and if the file does not exist at that server path then I need to check at the <strong>/xml/</strong> server path.</p>
  
  <p>Obviously from the browser we'll be accessing the <strong>/public_html/xml/</strong> path (e.g. <strong>www.example.com/xml/</strong>) so let's say we can see a directory index with Apache generated links to all the XML files. I want to be able to also access the files in the <strong>/xml/</strong> directory from <strong>example.com/xml/</strong>.</p>
  
  <p>There is also the issue of files having the exact name being present in both directories. I'd prefer the <strong>/public_html/xml/</strong> directory to take precedence so if a user requests <strong>www.example.com/xml/1.xml</strong>  the copy at <strong>/public_html/xml/1.xml</strong> is displayed instead of <strong>/xml/1.xml</strong> if possible.</p>
  
  <p>Remember, I want to MERGE access to all the files in both directories to a single directory, I do not want to make files from either directory inaccessible in order to make the files in other directory accessible.</p>
  
  <p>This must be done using the .htaccess file located at <strong>/.htaccess</strong> beneath.</p>