wsydney76/staticcache

Creates a staticcache of all web pages


Keywords
cms, Craft, craftcms, craft-plugin, staticcache
License
MIT

Documentation

Staticcache Plugin

Tbd.

CLI commands

  • craft staticcache/cache/create
  • craft staticcache/cache/delete

.htaccess

Single Site (replace 'default' with your site handle)

The static files are always written to web/cache/sitehandle, so if the handle is not part of the url, we have to add it manually to the rewrite rules.

# Custom cache rewrite
RewriteCond %{DOCUMENT_ROOT}/cache/default/%{REQUEST_URI}/%{QUERY_STRING}/index.html -s
RewriteCond %{REQUEST_METHOD} GET
RewriteRule .* /cache/default/%{REQUEST_URI}/%{QUERY_STRING}/index.html [L]

Multi Site

Works only, if the site handle is part of the url, eg. example.com/de/.... , where de matches the site handle.

# Custom cache rewrite
RewriteCond %{DOCUMENT_ROOT}/cache/%{REQUEST_URI}/%{QUERY_STRING}/index.html -s
RewriteCond %{REQUEST_METHOD} GET
RewriteRule .* /cache/%{REQUEST_URI}/%{QUERY_STRING}/index.html [L]

Events

For pagination handling.

tbd.

Known issues

  • Does not work (and is not intended to do so) with different domains for sites.