title: nginx ignoring Apache rewrite directive
body: <p>My problem is like this:
  - I now use nginx in front of Apache server wide meaning all my websites
  - all the rewrites I have in the .htaccess file work perfect, except 1 and up so far noone managed to give me a solution</p>
  
  <p>This is the .htaccess rule</p>
  
  <pre><code> -------------
      RewriteCond %{THE_REQUEST} ^.*/index\.(html|htm)\ HTTP/
      RewriteRule ^(.*)index\.(html|htm)$ http://%{HTTP_HOST}/$1 [R=301,L]
   -------------
  </code></pre>
  
  <p>This does the following:
  - it redirects with a 301 http code from www.domain.com/index.html to www.domain.com
  - it takes both index.html and index.htm</p>
  
  <p>Now the thing is that this worked prior to installing nginx and works so far for index.htm.. it redirects properly.
  But index.htm does not exist.</p>
  
  <p>I tried the other way around and found out that if the file exists, the redirect WON'T happen.</p>
  
  <p>Another weird thing that I found is the following: I also have mod_pagespeed installed from Google and when I access the URL with www.domain.com/index.html... the one that DOES NOT rewrite to /, this mod_pagespeed is... inactive.. meaning no changes occur in the source for instance....like that URL is not from the same normal requests.</p>
  
  <p>Btw..in ssh when I issue the nginx command I get this:</p>
  
  <pre><code>nginx: [warn] duplicate MIME type "text/html" in /etc/nginx/nginx.conf:30
  nginx: [emerg] bind() to 111.111.111.111:80 failed (98: Address already in use)
  nginx: [emerg] bind() to 111.111.111.111:80 failed (98: Address already in use)
  nginx: [emerg] bind() to 111.111.111.111:80 failed (98: Address already in use)
  nginx: [emerg] bind() to 111.111.111.111:80 failed (98: Address already in use)
  nginx: [emerg] bind() to 111.111.111.111:80 failed (98: Address already in use)
  nginx: [emerg] still could not bind()
  </code></pre>
  
  <p>111.111.111.111 - fake ip</p>
  
  <p>I've looked for the duplicate MIME.. can't find it there and the rest of the bind stuff...
  not a clue.</p>
  
  <p>If you guys have a clue I'd happily share a virtual mug of beer with you for a good piece of info.</p>
  
  <p>Thanks</p>