让rails忽略特定路径

mač*_*ček 6 ruby-on-rails

我的shared/文件夹中有一个文件my_app/public/夹,当试图通过www.my_app.com/shared访问它时,我看到:

no route matches '/shared', :method => 'get'

这是有道理的,但我希望rails忽略这个文件夹,让我使用Apache在这里呈现标准目录列表.

有什么办法吗?

Ale*_*ner 11

您需要做的就是禁用该目录的Passenger,并确保Indexes允许(目录列表).在Apache <VirtualHost>配置块中,添加:

<Location /shared>
  PassengerEnabled off
  Options +Indexes
</Location>
Run Code Online (Sandbox Code Playgroud)