[Hỏi] Cách bật tính năng bật nén cho xenforo

bạn dùng host thì liên hệ hỗ trợ, hoặc tìm các code gzip tự thêm vào file trong source, nếu có VPS thì có các bài chia sẻ rồi thì phải nhưng cách làm cũng tương tự. Thân!
 
  • Like
Reactions: THB
nghe đồn là thêm đoạn này vào header
PHP:
<?php if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) ob_start("ob_gzhandler"); else ob_start(); ?>
 
check ?
Nếu compression của Google PageSpeed thì bật minify js lên :D
abc.png
 
đờ phắc đùa nhau à =)). Hỏi thật mà, không thấy minify js, chỉ thấy minify css thôi :3
thật ấy chứ, lúc trước thấy có cái XFOptimise =))

ko thì tạo 1 file php gzip-js.php nội dung vầy

PHP:
<!--?php
   // initialize ob_gzhandler function to send and compress data
   ob_start ("ob_gzhandler");
   // send the requisite header information and character set
   header ("content-type: text/javascript; charset: UTF-8");
   // check cached credentials and reprocess accordingly
   header ("cache-control: must-revalidate");
   // set variable for duration of cached content
   $offset = 60 * 60;
   // set variable specifying format of expiration header
   $expire = "expires: " . gmdate ("D, d M Y H:i:s", time() + $offset) . " GMT";
   // send cache expiration header to the client broswer
   header ($expire);
?-->

xong nhét cái này vào htaccess

HTML:
<filesmatch "\.(js)"="">
    ForceType application/x-httpd-php
    php_value auto_prepend_file "/the/full/path/of/this/file/gzip-js.php"
</filesmatch>
 
  • Like
Reactions: THB
Back
Top