title: Redirecting & Rewriting URL with htaccess
body: <p>So i'm trying to get my head around using .htaccess - My folder structure is:</p>
  
  <p><code>website.com/www2/p/Home</code></p>
  
  <p>What i'm trying to do is:</p>
  
  <ol>
  <li>Redirect a URL to a subfolder (<em>website.com > website.com/www2/p/Home/</em>)</li>
  <li>Change the new URL to remove folder names (<em>website.com/www2/p/Home/ > website.com/Home/</em>)</li>
  </ol>
  
  <p>What i have so far that (kinda) works is the following:</p>
  
  <p><strong>.htaccess in website.com/</strong></p>
  
  <pre><code>Options -Indexes
  
  RewriteEngine On
  # RewriteBase /
  RedirectMatch ^/$ /www2/p/Home/
  RewriteRule !^/?www2/p www2/p%{REQUEST_URI} [L,NC]
  </code></pre>
  
  <p><strong>.htaccess in website.com/www2/p/</strong></p>
  
  <pre><code>RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+www2/p([^\s]*) [NC]
  RewriteRule ^ %1 [R=301,L]
  </code></pre>
  
  <p>This works but it breaks all my links &amp; relative paths in my php &amp; images + js &amp; css doesn't get loaded.</p>
  
  <p>I thought changing <code>RewriteBase</code> would help but what i'm trying isn't working. </p>
  
  <p>Edit:
  Inside p/ are different folders - eg. Home, About, Contact etc, each containing index.php</p>
  
  <p>My folder structure is as such:
  <img src="https://i.stack.imgur.com/Fd0lE.png" alt="folder structure"></p>