-
-
Save chrisdempsey/f4f1234773bc8158feb8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add this before your MODX Friendly URLs RewriteCond's and RewriteRule... | |
RewriteCond /abs/path/to/docroot/statcache%{REQUEST_URI} -f | |
RewriteRule ^(.*)$ /statcache/$1 [L,QSA] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
switch ($modx->event->name) { | |
case 'OnBeforeSaveWebPageCache': | |
if ($modx->resource->_output != '') { | |
$statcacheFile = $modx->getOption('statcache_path', $scriptProperties, MODX_BASE_PATH . 'statcache/') . $modx->makeUrl($modx->resource->get('id')); | |
if (!$modx->cacheManager->writeFile($statcacheFile, $modx->resource->_output)) { | |
$modx->log(modX::LOG_LEVEL_ERROR, "Error caching output from Resource {$modx->resource->get('id')} to static file {$statcacheFile}", '', __FUNCTION__, __FILE__, __LINE__); | |
} | |
} | |
break; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- web.config versin of Jason Coward's (Opengeek) .htaccess file --> | |
<rewrite> | |
<rules> | |
<rule name="Rewrite Statcache" stopProcessing="true"> | |
<match url="^(.*)$" ignoreCase="false" /> | |
<conditions> | |
<add input="/abs/path/to/docroot/statcache{URL}" matchType="IsFile" ignoreCase="false" /> | |
</conditions> | |
<action type="Rewrite" url="/statcache/{R:1}" appendQueryString="true" /> | |
</rule> | |
</rules> | |
</rewrite> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment