In Sinatra, how can I serve static index.html files in subdirectories in public folder?

Posted by socrateos on Stack Overflow See other posts from Stack Overflow or by socrateos
Published on 2010-04-12T11:03:34Z Indexed on 2010/04/12 12:03 UTC
Read the original article Hit count: 242

Filed under:
|
|

I noticed that Sinatra does not recognize index.html files in public folder's subdirectories and returns an error when url is pointing to a directory without specifiying the file name.

For example, if user enters a url like "www.mydomain.com/subdiretory/", Sinatra fails to recognize the existence of an index.html file in that directory.

There are hundreds of subdirectories in my public folder so that it is impossible to specify each one of them in code (and the number of subdirectories keeps growing).

How can I tell Sinatra to leave my web server (Apache) alone (to server index.html file) if there is an index.html file in a subdirectory of public folder when url is pointing to that directory without the file name?

© Stack Overflow or respective owner

Related posts about sinatra

Related posts about static-files