title: 500 Server Error - Infinite Loop
body: <h2>Symptoms</h2>
  
  <p>I am attempting to setup 2 virtual paths, one for each of my php applications.  One uses Kohana, another uses Zend.  Both home pages work fine.  When I browse deeper into the Kohana applicaion however, I get a 500 Internal Server error. </p>
  
  <p>Since I have only installed the Zend skeleton application, I only have but the one default homepage.  Because of this I may find out later, after adding new pages, that my Zend application also has this problem.  I do not, however, expect this to be the case because I did not experience any missing CSS on the home page as I did with the Kohana application (more on this symptom in the Kohana bootstrap section)</p>
  
  <h2>apache error log</h2>
  
  <p>Heres what the log file shows me, read it from bottom to top to see the pattern.</p>
  
  <pre><code>redirected from r-&gt;uri = /user/login, referer: http://app1:8080/
  redirected from r-&gt;uri = /app1/index.php/user/login, referer: http://app1:8080/
  redirected from r-&gt;uri = /app1/index.php/app1/index.php/user/login, referer: http://app1:8080/
  redirected from r-&gt;uri = /app1/index.php/app1/index.php/app1/index.php/user/login, referer: http://app1:8080/
  
  ...continues for 7 more loops, the redirect uri growing in the same pattern each time
  
  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., referer: http://app1:8080/
  </code></pre>
  
  <p>So from the log, there is obviously a loop caused by something I messed up in my code. I just dont know which one.</p>
  
  <h2>httpd.conf</h2>
  
  <p>This is what I added to <code>httpd.conf</code> to setup the new virtual host</p>
  
  <pre><code>&lt;VirtualHost app1:8080&gt;
      ServerName app1
      DocumentRoot /Applications/MAMP/htdocs/app1/
      SetEnv APPLICATION_ENV "development"
  &lt;/VirtualHost&gt;
  
  # this is for the zend app that seems to be working fine
  &lt;VirtualHost app2:8888&gt;
      ServerName app2
      DocumentRoot /Applications/MAMP/htdocs/app2/public
      SetEnv APPLICATION_ENV "development"
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <h2>etc/hosts</h2>
  
  <p>I dont think this is the problem, but just to be thorough here is what I added to the <code>hosts</code> file:</p>
  
  <pre><code>127.0.0.1       app1
  127.0.0.1       app2
  </code></pre>
  
  <h2>.htaccess</h2>
  
  <p>I also dont think the problem is in my <code>.htaccess</code> because I can comment the whole thing out and still get this error, but here it is anyway just so you can see what I've already added to try to fix it:</p>
  
  <pre><code># Turn on URL rewriting
  RewriteEngine On
  
  # Installation directory
  RewriteBase /
  
  # Protect application and system files from being viewed
  RewriteRule ^(?:application|modules|system)/ - [F,L]
  
  # Rewrite all other URLs to index.php/URL
  RewriteRule .* index.php [PT]
  
  RewriteLogLevel 3
  LogLevel debug
  </code></pre>
  
  <h2>Kohana bootstrap</h2>
  
  <p>Last but not least, the change I made to my Kohana <code>bootstrap.php</code> file that gave me a working home page.  Before this change I was getting served a CSSless html page:</p>
  
  <pre><code>Kohana::init(array(
      //'base_url'   =&gt; '/app1/',
      'base_url'     =&gt; '/',
      'index_file'   =&gt; false
  ));
  </code></pre>