Hi I would agree with you but this is not my approach. It's the way Zend_Cache_Backend_Static works and it's in the docs. Maybe the rules works fine in an .htaccess but I was asked to avoid them and have the configuration inside vhost.
Cheers holo 2010/9/29 Chris Riesen <[email protected]> > On Wed, Sep 29, 2010 at 8:14 PM, holografix . <[email protected]> > wrote: > > Hi > > I have an application in a VPS and I want some pages cached and avoid > PHP/ZF > > when they are requested. > > > > Vhost definition is like this: > > <VirtualHost *:80> > > ServerName www.app.com > > DocumentRoot "/www/sites/app/public" > > > > SetEnv APPLICATION_ENV production > > > > <Location /> > > RewriteEngine On > > > > # ============ FROM THE MANUAL ============ > > RewriteCond %{DOCUMENT_ROOT}/cached/index.html -f > > RewriteRule ^/*$ cached/index.html [L] > > > > RewriteCond > > %{DOCUMENT_ROOT}/cached/%{REQUEST_URI}.(html|xml|json|opml|svg) -f > > RewriteRule .* cached/%{REQUEST_URI}.%1 [L] > > # ========================================= > > > > RewriteCond %{REQUEST_FILENAME} -s [OR] > > RewriteCond %{REQUEST_FILENAME} -l [OR] > > RewriteCond %{REQUEST_FILENAME} -d > > RewriteRule ^.*$ - [NC,L] > > RewriteRule ^.*$ /index.php [NC,L] > > </Location> > > </VirtualHost> > > > > > > The pages are generated but they are generated every request so there is > no > > cache benefit. > > These rules are wrong. They don't force apache to serve the html cached > > files. > > Need some help with this. > > > > Thanks in advance. > > > > cheers > > holo > > > > Hi > > I have done something similar with apache, using the 404 handler. If > it finds a 404, it will call that script and based on the url given, > you can decide to serve up a 404 from PHP or handle it as a cache miss > and then write the file to the correct location, then deliver that > exact same content to the caller. Of course you don't have cache > expiration that way, so you would have to rewrite your content where > necessary if it changes. > > That being said, I can see your approach is similar in concept, using > mod_rewrite but I think you might be better off asking on the apache > mailing list how to configure your rewrite rule perfectly that, if a > file does not exist, it calls a script in the correct place. > > -- > Greetings, > Christian Riesen > http://christianriesen.com/ - My personal page > http://toreas.com/ - Toreas a free fantasy novel > http://gamewiki.net/ - Open Videogames Wiki >
