, , Url, WordPress, , - , mod_rewrite .
Url .htaccess mod_rewrite , ( md5 RewriteMap prg, ).
.htaccess , :
RewriteCond %{DOCUMENT_ROOT}/cache/$1/index.html -f
RewriteRule ^(.*) /cache/$1/index.html [L]
Php, CodeIgniter, Php, , ob_start ob_get_clean:
private function cache_output() {
$this->load->helper('url');
$uri = uri_string();
$dir = FCPATH.'cache'.DIRECTORY_SEPARATOR.str_replace('/',DIRECTORY_SEPARATOR,$uri);
$file = $dir.DIRECTORY_SEPARATOR.'index.html';
if (!file_exists($file)) {
if (!is_dir($dir)) {
mkdir($dir, 0755 & ~umask(), TRUE);
}
$output = $this->output->get_output();
file_put_contents($file, $output);
chmod($file, 0644 & ~umask());
}
}