title: .htaccess, cannot get first part of a URL in rewrite condition
body: <p>I am attempting to get the following results with an .htaccess file.</p>
  
  <pre><code>URL:                      Behavior(rewrite to):
  example.com/x/            view-test.php?page=x
  example.com/x/y           view-test.php?page=y&amp;parent=x
  example.com/x/y/z         view-test.php?page=z&amp;parent=y&amp;grandparent=z
  </code></pre>
  
  <p>I have the following .htaccess rules, which also include some folders which needs to ignore this scheme:</p>
  
  <pre><code>RewriteCond %{REQUEST_URI}!^/(admin|images|scripts|css|fonts|view-test\.php)/ [NC]
  RewriteRule ([^/]*)/([^/]*)/([^/]+)/?$ /view-test.php?grandparent=$1&amp;parent=$2&amp;page=$3  [L]
  
  RewriteCond %{REQUEST_URI}!^/(admin|images|scripts|css|fonts|view-test\.php)/ [NC]
  RewriteRule ([^/]*)/([^/]+)/?$ /view-test.php?&amp;parent=$1&amp;page=$2 [L]
  
  RewriteCond %{REQUEST_URI}!^/(admin|images|scripts|css|fonts|view-test\.php)/ [NC]
  #RewriteRule ([^/]+)$ /view-test.php?page=$1 [L]
  </code></pre>
  
  <p>however, whenever I uncomment the last two lines I get an internal server error. the parent/page and grandparent/parent/page structures work fine. How can I re-write this last rule (and the preceding rules if nessecary) to achieve the desired result for the first pattern (just a page)?</p>