views:

712

answers:

2

I'm using Apache with passenger to run a rails app. In my rails app, I have some static content in subdirectories of the public directory. Each subdirectory has an index.html in it.

So, inside the public directory, I have a subdir called 'b' and inside it, is an index.html. So it's like this:

/public/b/index.html

I have links to these pages, of the form:

http://a.com/b

If I do this in my regular non-rails web directory, Apache correctly rewrites this URL to be http://a.com/b/ which then, subsequently shows the index.html. It's only when accessing my rails app that it doesn't work. In fact, if I turn off passenger mod... so it just accesses my rails app like a regular document root, it works correctly also.

What the heck do I need to do to get this to work properly with passenger? Again, it works fine in apache itself when passenger is not involved.

I am running passenger 2.1.3. I have another server running passenger 2.0 that doesn't seem to have this problem, but I don't see anything different in the config other than the different versions of passenger itself.

HELP! Been working on this for two days solid with no improvement!

A: 

Do you have PassengerHighPerformance on? That can interfere with index pages.

MarkusQ
No I don't. I reverted my passenger from 2.1.3 to 2.0.6 and the problem went away. I think it's something broken in 2.1.3.
Portamento
A: 

Add the following rewrite rule to your apache config:

# Turn on URL rewriting
RewriteEngine On
# For a given url foo, check if foo/index.html exists as a static file
RewriteRule ^([^.]+)$ $1/index.html [QSA]
ktheory