title: Rails 3: Redirect loop caused by appended `/` to URL
body: <p><strong>Background Info</strong></p>
  
  <p>setup: Rails 3 + Apache2 + Phusion Passenger 3.0.7</p>
  
  <p>I deployed a Rails 3 app to a sub URI on my domain (which is also a Rails 3 app). I'm using Phusion Passenger 3.0.7 to deploy my Rails apps.</p>
  
  <p><strong>The Problem</strong></p>
  
  <p>When navigating to <a href="http://mydomain.com/suburi/" rel="nofollow">http://mydomain.com/suburi/</a> I get a <code>HTTP/1.1 301 Moved Permanently</code> message. Notice the appended <code>/</code>. However, when navigating to <a href="http://mydomain.com/suburi/home" rel="nofollow">http://mydomain.com/suburi/home</a>, or <a href="http://mydomain.com/suburi" rel="nofollow">http://mydomain.com/suburi</a> everything works fine.</p>
  
  <p>Any help would be much appreciated.</p>
  
  <p>Here is my Apache configuration file:</p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
    CheckSpelling on
  
    PassengerFriendlyErrorPages Off
  
    ServerName mydomain.com
    ServerAlias www.mydomain.com
    DocumentRoot /www/mydomain/public
  
    &lt;Directory /www/mydomain/public&gt;
        RackEnv production
        Options FollowSymLinks -MultiViews
        Order allow,deny
        Allow from all
        AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript text/css application/x-javascript
    &lt;/Directory&gt;
  
    RackBaseURI /suburi
    &lt;Directory /www/mydomain/public/suburi&gt;
        RackEnv production
        AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript text/css application/x-javascript
        Options -MultiViews
    &lt;/Directory&gt;
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>Here is my routes.rb file:</p>
  
  <pre><code>MyApp::Application.routes.draw do   
  
      # snipped code that wouldn't affect anything...
  
      root :to =&gt; "home#index"
  end
  </code></pre>