0

Does anybody have some working Apache mod_rewrite rules that enable Phusion Passenger (mod_rails) to use a non-default location for the page cache within a Rails application? I'd like the cached files to go in /public/cache rather than the default of /public.

John Topley
  • 2,045
  • 3
  • 16
  • 17

2 Answers2

0

I found the answer in this blog post:

RailsAllowModRewrite On  
RewriteEngine On

RewriteCond %{THE_REQUEST} ^(GET|HEAD)
RewriteCond %{REQUEST_URI} ^/([^.]+)$
RewriteCond %{DOCUMENT_ROOT}/cache/%1.html -f
RewriteRule ^/[^.]+$ /cache/%1.html [QSA,L]

RewriteCond %{THE_REQUEST} ^(GET|HEAD)
RewriteCond %{DOCUMENT_ROOT}/cache/index.html -f
RewriteRule ^/$ /cache/index.html [QSA,L]
John Topley
  • 2,045
  • 3
  • 16
  • 17
0

The answer with RailsAllowModRewrite does not works, as in new versions RailsAllowModRewrite does nothing, but the passenger interaction with mod_rewrite seems to be broken.