Rails 3:由URL附加`/`引起的重定向循环

时间:2011-05-18 00:35:53

标签: ruby-on-rails ruby-on-rails-3 apache2 passenger redirect-loop

背景资讯

设置:Rails 3 + Apache2 + Phusion Passenger 3.0.7

我将Rails 3应用程序部署到了我的域(也是Rails 3应用程序)上的子URI。我正在使用Phusion Passenger 3.0.7来部署我的Rails应用程序。

问题

导航到http://mydomain.com/suburi/时,我收到HTTP/1.1 301 Moved Permanently条消息。请注意附加的/。但是,导航到http://mydomain.com/suburi/homehttp://mydomain.com/suburi时一切正常。

非常感谢任何帮助。

这是我的Apache配置文件:

<VirtualHost *:80>
  CheckSpelling on

  PassengerFriendlyErrorPages Off

  ServerName mydomain.com
  ServerAlias www.mydomain.com
  DocumentRoot /www/mydomain/public

  <Directory /www/mydomain/public>
      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
  </Directory>

  RackBaseURI /suburi
  <Directory /www/mydomain/public/suburi>
      RackEnv production
      AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript text/css application/x-javascript
      Options -MultiViews
  </Directory>
</VirtualHost>

这是我的routes.rb文件:

MyApp::Application.routes.draw do   

    # snipped code that wouldn't affect anything...

    root :to => "home#index"
end

1 个答案:

答案 0 :(得分:0)

罪魁祸首最终成为我通过mod_speling启用的CheckSpelling on Apache模块。禁用该模块后,我没有其他问题。