Note that there are some explanatory texts on larger screens.

plurals
  1. PO.htaccess %{REQUEST_URI} trailing slash and Zend Cache
    text
    copied!<p>I have a php caching system(based on Zend Static Cache) ... that creates static html files from dynamic pages. It uses the REQUEST_URI to create the file names. For a REQUEST_URI like this /somedir/otherdir/file.html it creates a file in the cached dir (on my server) like this /cached/somedir/otherdir/file.html.</p> <p>I then use htaccess to redirect future requests to the static file if it exists:</p> <pre><code>RewriteCond %{DOCUMENT_ROOT}/cached/%{REQUEST_URI}\.html -f RewriteRule .* /cached/%{REQUEST_URI}\.html [L] </code></pre> <p>The problem I'm having is that when the REQUEST_URI ends in "/" (basicaly a directory) the cache generates a file named thedirectory.html.</p> <p>So if the REQUEST_URI is /thedirectory/ ... I get a this file cached/thedirectory.html.</p> <p>How would I go about redirecting such a request to the right file. </p> <p>Thanks. PS: I've basically followed <a href="http://translate.google.com/translate?hl=en&amp;sl=fr&amp;u=http://blog.developpez.com/lucas-corbeaux/p9647/php/zend-framework/zend-cache-backend-static-zend-framework/&amp;ei=ivAvT_jKCK6F0QH9qoXnCg&amp;sa=X&amp;oi=translate&amp;ct=result&amp;resnum=1&amp;ved=0CCkQ7gEwAA&amp;prev=/search?q=%255BPHP%255D%255BWeb%255D%2bMise%2ben%2bplace%2bd%2527un%2bcache%2bStatic%2bavec%2ble%2bZend%2bFramework&amp;hl=en&amp;client=firefox-a&amp;hs=pq6&amp;rls=org.mozilla%3aen-US%3aofficial&amp;prmd=imvns" rel="nofollow">this article</a> to implement my cache. I'm using the Zend Cache files only on a custom php app.</p> <h2>EDIT:</h2> <p>I guess there's no good way to make this work without editing the php files. Here's how I use Zend Cache :</p> <pre><code>$tagCache = Zend_Cache::factory('Core', 'File', array('automatic_serialization' =&gt; true), array('cache_dir' =&gt; $cfg['instdir']. 'Cache_dir')); $cache = Zend_Cache::factory('Capture', 'Static', array(), array('public_dir' =&gt; $cfg['instdir']. 'Cached/', 'tag_cache' =&gt; $tagCache)); $id = bin2hex($name); $cache-&gt;start($id, array()); </code></pre> <p>Does any one know what files are likely to hold the code for generating the cache file name? I've edited a couple of frontends,backends ..but nothing seems to be happening.</p> <p>I'm trying to do something like(just before ZEND gets the REQUEST_URI ): </p> <pre><code>if(substr($_SERVER["REQUEST_URI"],strlen($_SERVER["REQUEST_URI"])-1,1)=="/") </code></pre> <p>{</p> <p>$_SERVER["REQUEST_URI"]=$_SERVER["REQUEST_URI"]."index.html";</p> <p>}</p> <p>too make the cache add a index.html file for directories.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload