Apache Page Caching and Multiview

Charles Brian Quinn

2 min read

Aug 3, 2009

Apache Page Caching and Multiview

I just wanted to post a quick note to anyone searching for problems with Rails Page Caching with Apache.

We just helped a client through a tricky issue that manifested itself through some strangely generated cached files.

The Problem

A visit to the resource:

Would correctly generate the page:


Subsequent visits would load the cached page.

However, if you then tried to visit a page like:

Where a route used that for pagination, or simply any action off that resource, you apache would try and request a file like:


This is problematic, and does not work.

If, however, you removed the cached file and instead created the directory first, like so:


When you requested the resource:

it would correctly generate an index file:


And then correctly generate any cached pages inside the directory like 2.html, 3.html for pagination (if setup in rails routes correctly).

The Solution

The problem was that Apache has the MultiViews option turned on.

We changed the server configuration file from this:

<Location />
Options All FollowSymLinks MultiViews -Indexes

to this:

<Location />
Options All FollowSymLinks -Indexes

When you remove this option from the configuration, you get the correct caching behavior, which is that requests to:

Still generate the cached file:


But now, requests to the slash-ending url and resources off that route:

Now correctly generate a folder with an index.html and 2.html, which caches just fine.

I hope this helps someone else out!


Josh Justice

Reviewer Big Nerd Ranch

Josh Justice has worked as a developer since 2004 across backend, frontend, and native mobile platforms. Josh values creating maintainable systems via testing, refactoring, and evolutionary design, and mentoring others to do the same. He currently serves as the Web Platform Lead at Big Nerd Ranch.

Speak with a nerd

Schedule a call today! Our team of nerds are ready to help

Let's Talk

Related Posts

We are ready to discuss your needs.

Stay in Touch WITH Big Nerd Ranch News