# Route to static folder (to browse files)

**URL:** <https://www.ruby-forum.com/t/route-to-static-folder-to-browse-files/172494>\
**Category:** Rails\
**Created:** [July 22, 2009, 11:47am UTC](https://www.ruby-forum.com/t/route-to-static-folder-to-browse-files/172494 "2009-07-22T11:47:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sa125](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b4bc9f/32.png) [@sa125](https://www.ruby-forum.com/u/sa125)\
**Post date:** [July 22, 2009, 11:47am UTC](https://www.ruby-forum.com/t/route-to-static-folder-to-browse-files/172494/1 "2009-07-22T11:47:47Z")

</div>

Hi -

I want to enable access to a directory inside my app’s public folder.  
This means that when a user will navigate to [应用宝官网-全网最新最热手机应用游戏下载](http://myapp.com/files), he  
will actually be accessing the root of RAILS\_ROOT/public/files. This  
folder will contain static files, and doesn’t really need any  
controller/actions - mostly to be used as a static file server (js, css)  
for another app.

I’m trying to accomplish that through the routes.rb file, but so far w/o  
success. Is it possible?

Thanks!

---

<div class="post-metadata">

**Author:** ![sa125](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b4bc9f/32.png) [@sa125](https://www.ruby-forum.com/u/sa125)\
**Post date:** [July 22, 2009, 12:17pm UTC](https://www.ruby-forum.com/t/route-to-static-folder-to-browse-files/172494/2 "2009-07-22T12:17:27Z")

</div>

Hey,

That shouldn’t need any modification to your routes. Unless you have a  
very  
peculiar setup, files from your ./public/ directory are automatically  
served  
as static.

RAILS\_ROOT/public/files/some\_file.pdf

Should be accessible as:

> **[应用宝官网-全网最新最热手机应用游戏下载](https://sj.qq.com)**
>
> 应用宝是腾讯旗下官方手机app应用商店，致力于为您提供海量、优质、安全、最新的安卓应用游戏下载！

Regards,  
Gustav P.

On Wed, Jul 22, 2009 at 11:47 AM, sa 125

---

<div class="post-metadata">

**Author:** ![sa125](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b4bc9f/32.png) [@sa125](https://www.ruby-forum.com/u/sa125)\
**Post date:** [July 22, 2009, 4:00pm UTC](https://www.ruby-forum.com/t/route-to-static-folder-to-browse-files/172494/3 "2009-07-22T16:00:55Z")

</div>

One additional note here for Apache users: it is pretty standard to  
turn off the “browsing” feature on directories. If your virtual host  
configuration allows for it you can override this option on a per  
directory basis with .htaccess files.

To enable:  
Options Indexes

To disable:  
Options -Indexes

---

<div class="post-metadata">

**Author:** ![sa125](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b4bc9f/32.png) [@sa125](https://www.ruby-forum.com/u/sa125)\
**Post date:** [July 22, 2009, 3:26pm UTC](https://www.ruby-forum.com/t/route-to-static-folder-to-browse-files/172494/4 "2009-07-22T15:26:15Z")

</div>

Gustav P. wrote:

> That shouldn’t need any modification to your routes. Unless you have a  
> very  
> peculiar setup, files from your ./public/ directory are automatically  
> served  
> as static.
> 
> RAILS\_ROOT/public/files/some\_file.pdf
> 
> Should be accessible as:
> 
> [应用宝官网-全网最新最热手机应用游戏下载](http://myapp.com/files/some_file.pdf)

Gustav - you’re right, I was taking a long detour instead of the direct  
rout (pun intended). Thanks!
