This work for me on php apache wordpress + w total cache + amp put it on the top of php page
Example:
PHP
<?Php
if(substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')){
ob_start ('ob_html_compress');
}else{
ob_start();
}
function ob_html_compress($buf) {
$search = array('/\>[^\S ]+/s', '/[^\S ]+\</s', '/(\s)+/s', '/<!--(.|\s)*?-->/');
$replace = array('>', '<', '\\1', '');
$buf = preg_replace($search, $replace, $buf);
return $buf;
return str_replace(array("\n","\r","\t"),'',$buf);
}
?>
How to minify all html code of Your Website | PHP Cache Tutorial |
How to minify html code of Your Website | PHP Cache Tutorial |
How to make short all codes of your website | PHP Cache Tutorial |
How to create PHP Simple HTML Cache for a Web Page | PHP Cache Tutorial |
How to minify all code of Your Website | PHP Cache Tutorial |
Type: | Php |
Category: | Web Tutorial |
Sub Category: | PHP Cache Tutorial |
Uploaded by: | Admin |