title: .htaccess lowercase rewrite causes HTTP error
body: <p>I'm trying to write an .htaccess rewrite based on modified code from <a href="http://www.askapache.com/htaccess/rewrite-uppercase-lowercase.html" rel="nofollow" title="askapache.com">here</a> that will convert URLs like this:</p>
  
  <pre><code>http://eXAMplE.CoM/sOMe-PatH/aNOTHer-PAth/FILEName.eXT
  </code></pre>
  
  <p>To this:</p>
  
  <pre><code>http://example.com/some-path/another-path/FILEName.eXT
  </code></pre>
  
  <p>Basically converting the entire URL to lowercase and excluding the filename. </p>
  
  <p><strong>[PROBLEM]</strong>
  My .htaccess seems to be working OK with one exception: When anything beyond the initial path includes a capital letter, it results in no data from the server. I assume it's causing an infinite loop but can't be sure because I can't access the logs.</p>
  
  <p>To clarify, this works:</p>
  
  <pre><code>http://eXAMplE.CoM/sOMe-PatH/FILEName.eXT
  </code></pre>
  
  <p>This does not:</p>
  
  <pre><code>http://eXAMplE.CoM/sOMe-PatH/aNOTHer-PAth/FILEName.eXT
  </code></pre>
  
  <p>Here is my code. Can anyone help?</p>
  
  <pre><code>RewriteEngine On
  RewriteBase /
  
  # Skip this entire section if no uppercase letters in requested URL
  RewriteRule !.*?[A-Z].*\/.* - [S=28]
  
      # Replace single occurance of CAP with cap, then process next Rule.
      RewriteRule ^([^A]*)A(.*\/.*)$ $1a$2
      RewriteRule ^([^B]*)B(.*\/.*)$ $1b$2
      RewriteRule ^([^C]*)C(.*\/.*)$ $1c$2
      RewriteRule ^([^D]*)D(.*\/.*)$ $1d$2
      RewriteRule ^([^E]*)E(.*\/.*)$ $1e$2
      RewriteRule ^([^F]*)F(.*\/.*)$ $1f$2
      RewriteRule ^([^G]*)G(.*\/.*)$ $1g$2
      RewriteRule ^([^H]*)H(.*\/.*)$ $1h$2
      RewriteRule ^([^I]*)I(.*\/.*)$ $1i$2
      RewriteRule ^([^J]*)J(.*\/.*)$ $1j$2
      RewriteRule ^([^K]*)K(.*\/.*)$ $1k$2
      RewriteRule ^([^L]*)L(.*\/.*)$ $1l$2
      RewriteRule ^([^M]*)M(.*\/.*)$ $1m$2
      RewriteRule ^([^N]*)N(.*\/.*)$ $1n$2
      RewriteRule ^([^O]*)O(.*\/.*)$ $1o$2
      RewriteRule ^([^P]*)P(.*\/.*)$ $1p$2
      RewriteRule ^([^Q]*)Q(.*\/.*)$ $1q$2
      RewriteRule ^([^R]*)R(.*\/.*)$ $1r$2
      RewriteRule ^([^S]*)S(.*\/.*)$ $1s$2
      RewriteRule ^([^T]*)T(.*\/.*)$ $1t$2
      RewriteRule ^([^U]*)U(.*\/.*)$ $1u$2
      RewriteRule ^([^V]*)V(.*\/.*)$ $1v$2
      RewriteRule ^([^W]*)W(.*\/.*)$ $1w$2
      RewriteRule ^([^X]*)X(.*\/.*)$ $1x$2
      RewriteRule ^([^Y]*)Y(.*\/.*)$ $1y$2
      RewriteRule ^([^Z]*)Z(.*\/.*)$ $1z$2
  
      # If there are any uppercase letters, restart at very first RewriteRule in file.
      RewriteRule .*?[A-Z].*\/.* - [N]
  
      # Force a redirect with the new lowercase URL.
      RewriteRule (.*) $1 [R=301,L]
  
  &lt;IfModule mod_rewrite.c&gt;
  RewriteEngine On
  RewriteCond %{HTTP_HOST} !^www\.
  RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
  
  RewriteBase /
  RewriteRule ^index\.php$ - [L]
  
  # uploaded files
  RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
  
  # add a trailing slash to /wp-admin
  RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
  
  RewriteCond %{REQUEST_FILENAME} -f [OR]
  RewriteCond %{REQUEST_FILENAME} -d
  RewriteRule ^ - [L]
  RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
  RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
  RewriteRule . index.php [L]
  &lt;/IfModule&gt;
  </code></pre>