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

tpoclub

Corporal
Tham gia
07/03/2015
Bài viết
115
Được Like
100
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

ismartcom005

MasterSergeant
Tham gia
14/04/2015
Bài viết
839
Được Like
798
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(); ?>
 

2L.Ohayo

Moderator
Thành viên BQT
Tham gia
08/03/2015
Bài viết
761
Được Like
835
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(); ?>
không được thím ơi, em thêm rồi :))
 

ismartcom005

MasterSergeant
Tham gia
14/04/2015
Bài viết
839
Được Like
798
check ?
Nếu compression của Google PageSpeed thì bật minify js lên :D
abc.png
 

ismartcom005

MasterSergeant
Tham gia
14/04/2015
Bài viết
839
Được Like
798
lấy hết js ra vào mấy trang jscompress =))
 
  • Like
Reactions: THB

ismartcom005

MasterSergeant
Tham gia
14/04/2015
Bài viết
839
Được Like
798
đờ 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

Hướng dẫn sử dụng

XenForo 1 XenForo 2
Translate by PVS

Dịch vụ XenForo của VNXF

Mr. Tuấn

Mobile/Zalo: 0988 488 096

Telegram: bluekpro

Email: [email protected]

Nhà Tài Trợ

Mút Xốp Không Gian
pallet Thịnh Phát
Top Bottom