title: htaccess multiple rewrite rules for different GET variables
body: <p>I am trying to use htaccess Rewrite Rules to map multiple GET variables, but not all the variables are required.  I have ordered the variables so that x is always required, if y is set, then z must be set, etc.  So I need the mappings to look like this:</p>
  
  <pre><code>example.com/section/topic/sub
  </code></pre>
  
  <p>to map to</p>
  
  <pre><code>example.com/?x=section&amp;z=topic&amp;y=sub
  </code></pre>
  
  <p>However the following code causes Internal Error, but if I only have one Rewrite Rule, it works.</p>
  
  <pre><code>Options +FollowSymLinks
  Options -indexes
  &lt;IfModule mod_rewrite.c&gt;
  RewriteEngine on
  RewriteBase /
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_URI}  ([^/]+)/?   [NC]
  RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)$  ?x=$1&amp;z=$2&amp;y=$3&amp;r=$4    [NC,L]
  RewriteRule ^([^/]+)/([^/]+)/([^/]+)$  ?x=$1&amp;z=$2&amp;y=$3    [NC,L]
  RewriteRule ^([^/]+)/([^/]+)$  ?x=$1&amp;z=$2    [NC,L]
  RewriteRule ^([^/]+)$  ?x=$1    [NC,L]
  
  &lt;/IfModule&gt;
  </code></pre>
  
  <p>I also need to ensure the url <em>can</em> have a trailing /, but does not require it.</p>
  
  <p>As you can probably tell, I am new to htaccess.</p>
  
  <p>Thank You</p>