title: attempt at using htaccess rewrite rules - not working
body: <p>I'm developing a simple website using PHP and have gotten stuck at trying to format the URLs into having "pretty" URLs.</p>
  
  <p>Currently, this site is not running of the root directory; ie not from "localhost" but instead from a sub directory, ie localhost/resources/vuws/. So to link to the correct files I've defined the "Site URL" to "<a href="http://localhost/resources/vuws/" rel="nofollow noreferrer">http://localhost/resources/vuws/</a>".</p>
  
  <p>As such:</p>
  
  <pre><code>define("SITEURL", "http://localhost/resources/vuws/");
  </code></pre>
  
  <p>This is how I'm directing users to different pages:</p>
  
  <pre><code>    $title = 'vUWS';
      $heading = 'Welcome';
      $content = 'index.php';
  
  $page = @$_GET['p'];
          switch($page) {
            case 'how-to-upload-a-file':
              $title = 'How to upload a file';
              $content = 'how-to-upload-a-file.php';
              break;
            case 'how-to-make-an-announcement':
              $title = 'How to make an announcement';
              $content = 'how-to-make-an-announcement.php';
              break;
            case 'how-to-add-teaching-staff':
              $title = 'How to add teaching staff';
              $content = "how-to-add-teaching-staff.php";
              break;
          }
  </code></pre>
  
  <p>Then in the content area:</p>
  
  <pre><code>&lt;?php
     require_once(dirname(__FILE__) . "/pages/$content");
  ?&gt;
  </code></pre>
  
  <p>And this is my attempt at using redirects in htaccess but it's not working.</p>
  
  <pre><code>RewriteEngine On
  RewriteBase /resources/vuws/
  
  RewriteCond %{SCRIPT_FILENAME} !-f [NC]
  RewriteCond %{SCRIPT_FILENAME} !-d [NC]
  RewriteRule ^(.+)$ index.php?p=$1 [QSA,L]
  </code></pre>
  
  <p>When I try to access "localhost/resources/vuws/how-to-upload-a-file", it directs to just index.php. I believe it may not be receiving a value for $_GET['p'], therefore it's not entering the switch statement and so it's then using the default value for $content which is "index.php".</p>
  
  <p>If I access it via "localhost/resources/vuws/?p=how-to-upload-a-file" it works. But if I try "localhost/resources/vuws/how-to-upload-a-file" it doesn't work.</p>
  
  <p>Currently, I'm not too sure how to approach this issue or a better way to debug this problem.</p>
  
  <p>Any help would be greatly appreciated.</p>
  
  <p>Thanks in advance,</p>
  
  <p>Johnny</p>
  
  <p>PS: At the moment using Virtual Hosts is not an option, it needs to be able to run from a sub directory.</p>