title: codeigniter rewrite rule leads to infinite loop
body: <p>I'm using CodeIgniter, and I'm getting a 500 server error when I try to visit my page.
  (<a href="https://test_page.com" rel="nofollow">https://test_page.com</a>) which redirects to 
  (<a href="https://test_page.com/auth/login" rel="nofollow">https://test_page.com/auth/login</a>).
  Notice how
  (<a href="https://test_page.com/index.php/auth/login" rel="nofollow">https://test_page.com/index.php/auth/login</a>) still works.</p>
  
  <ol>
  <li>Im using HTTPS://, and I'm not sure if that makes a difference or not.</li>
  <li>I have also configured my sites-available file for the domain to allowoverride.</li>
  </ol>
  
  <blockquote>
    <p>Codeigniter base directory:
    <strong>/var/www/test_page.com/public_html</strong></p>
  </blockquote>
  
  <p>My apache error log says:</p>
  
  <blockquote>
    <p>Request exceeded the limit of 10 internal redirects due to probable
    configuration error. Use 'LimitInternalRecursion' to increase the
    limit if necessary. Use 'LogLevel debug' to get a backtrace.</p>
  </blockquote>
  
  <h2>httpd.conf file</h2>
  
  <pre><code>ServerName localhost
  
  &lt;Directory /var/www/test_page.com/public_html&gt;
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    Allow from all
  &lt;/Directory&gt;
  </code></pre>
  
  <p><strong>.htaccess</strong></p>
  
  <pre><code>Options +FollowSymLinks All -Indexes
  
  &lt;IfModule mod_rewrite.c&gt;
      RewriteEngine On
      RewriteBase /registration.naturebridge.org/
  
      RewriteCond %{REQUEST_URI} ^system.*
      RewriteRule ^(.*)$ index.php?/$1 [L]
  
      RewriteCond %{REQUEST_URI} ^application.*
      RewriteRule ^(.*)$ index.php?/$1 [L]
  
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ^(.*)$ /public_html/index.php?/$1 [L]
  &lt;/IfModule&gt;
  
  &lt;IfModule !mod_rewrite.c&gt;
      ErrorDocument 404 index.php
  &lt;/IfModule&gt;  
  </code></pre>
  
  <h2>config file:</h2>
  
  <pre><code>$config['base_url'] = 'https://test_page.com/';
  $config['index_page'] = '';
  $config['uri_protocol'] = 'REQUEST_URI';
  $config['url_suffix'] = '';
  </code></pre>
  
  <h2>The solution</h2>
  
  <p>Edit your .htaccess to include the following (also remember to not edit it in Word or a rich text format editor as it could add extra characters and give you a compilation error).</p>
  
  <pre><code>&lt;IfModule mod_rewrite.c&gt;
      RewriteEngine On
      RewriteBase /
  
      RewriteCond %{REQUEST_URI} ^system.*
      RewriteRule ^(.*)$ /index.php?/$1 [L]
  
      RewriteCond %{REQUEST_URI} ^application.*
      RewriteRule ^(.*)$ /index.php?/$1 [L]
  
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ^(.*)$ index.php?/$1 [L]
  &lt;/IfModule&gt;
  </code></pre>