Cropping Rails pages with Apache and capistrano

The following article explains page caching in rails with Nginx.

http://blog.hasmanythrough.com/2008/1/30/segregated-page-cache-storage

I like to implement this solution with my application, but on Apache. So the main block / route

  if (-f $ request_filename) { 
    break; 
  }
    if (-f / cache $ request_filename) { 
    rewrite (. *) / cache $ 1 break;
    break; 
  }

  if (-f /cache$request_filename.html) { 
    rewrite (. *) /cache$1.html break;
    break; 
  }

What could be the Apache equivalent for the above Nginx related code?

0


a source to share


1 answer


This is what I am using:

RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule ^/$ /cache/index.html [QSA]
RewriteRule ^([^.]+)$ /cache$1.html [QSA]

      



The second line checks to see if the cached file exists before doing the redirect, otherwise it will pass the request to Rails.

0


a source







All Articles