Static cache with index.php in URL path

Author Message

Geraint Edwards

Wednesday 29 June 2005 3:44:54 am

I finally got static caching to work (V. NICE enhancement) and thought I'd share an insight.

The helpful setup summary at http://ez.no/ez_publish/download/changelogs/ez_publish_3_6/new_features/static_caching_of_content
assumes a URL path that does not include index.php - if you are forced to include the index.php in your path because of your hosting configuration the instructions won't quite work.

The following rewrite rules works for me and may help others in the same situation:

RewriteCond %{REQUEST_URI} !\.(gif|jpe?g|png|css|js|html|ico|jar|xml)|index\.php|\.pdf$
RewriteRule ^(.*) /index.php/$1 

RewriteCond   /var/www/ezCloc/static/{siteaccess}/index.html -f
RewriteRule  ^/$              /static/{siteaccess}/index.html [L]
RewriteCond   /var/www/ezCloc/static/{siteaccess}/index.html -f
RewriteRule  ^$               /static/{siteaccess}/index.html [L]

RewriteCond   %{REQUEST_METHOD}       !^POST$
RewriteCond %{REQUEST_URI} !\.(gif|css|jpg|png|jar|ico|js|html|xml)$
RewriteCond %{REQUEST_URI} ^\/index.php\/(.*)
RewriteCond   {rootDir}/static/$1/index.html -f
RewriteRule   ^index.php\/(.*)$  /static/$1/index.html [L]

Hope that helps someone.

p.s. Of course <b>I now need to start to strip out unnecssary POST requests that merely obtain static content e.g. for displaying images in the gallery etc.</b>

Geraint

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.