title: htaccess causing server error 500
body: <p>I have a Zend Framework application with a <code>.htaccess</code> file in the root directory, directing all traffic to the <code>/public</code> directory, where <code>index.php</code> resides.</p>
  
  <p>This is the contents of the <code>.htaccess</code>:</p>
  
  <pre><code>RewriteEngine On
  
  RewriteRule ^\.htaccess$ - [F]
  
  RewriteCond %{REQUEST_URI} =""
  RewriteRule ^.*$ /public/index.php [NC,L]
  
  RewriteCond %{REQUEST_URI} !^/(upload|img|js|css|less)/.*$
  RewriteCond %{DOCUMENT_ROOT}/public/upload%{REQUEST_URI} -f
  RewriteRule ^(.+\.(jpg|png|mp3))$ /public/upload%{REQUEST_URI} [NC,L]
  
  ;RewriteCond %{REQUEST_URI} !^/public/.*$
  ;RewriteRule ^(.*)$ /public/$1
  
  RewriteCond %{REQUEST_FILENAME} -f
  RewriteRule ^.*$ - [NC,L]
  
  RewriteRule ^public/.*$ /public/index.php [NC,L]
  </code></pre>
  
  <p>As you can see, there are two commented out lines.</p>
  
  <p>The section, supposedly directing traffic to <code>/public</code>, and which works on my local servers and my shared host, seems to fail miserably on my client's server.</p>
  
  <p>So, with the two lines commented out, when I type the site's address in the browser, I get a directory listing. When I append <code>/public</code> to the address, I'm taken to <code>/public/index.php</code>, as expected, but since the request wasn't redirected correctly, neither are the ones to the JS and CSS files.</p>
  
  <p>When I uncomment the lines, I get a 500 internal server error (<code>index.php</code> is not reached at all).</p>
  
  <p>The other rewrites work correctly (at least as far as I can tell).</p>
  
  <p>Any ideas why this would happen and how to correct this?</p>
  
  <p>Thanks in advance.</p>