Bí kíp tăng tốc load website lên 75-90 điểm, tốc độ load web 0.5s : + Nén dung lượng ảnh tuyệt đối + Tắt hiệu ứng thừa, thay thế slide ảnh nhẹ + Nén css, chặn java hệ thống làm nặng web + Tăng siêu cache cho web, nén Gzip + Giảm tải link out ngoài hệ thống + Chèn thêm mã nén cache giảm tải java vào .htacess + Mã nén mình gửi ở dưới nhé Test tốc độ : http://vincity.thaibinhweb.net/ PHP: Mã nén chèn vào .htacess# BEGIN Expire headers# END Expire headers<ifModule mod_gzip.c>mod_gzip_on Yesmod_gzip_dechunk Yesmod_gzip_item_include file .(html?|txt|css|js|php|pl)$mod_gzip_item_include handler ^cgi-script$mod_gzip_item_include mime ^text/.*mod_gzip_item_include mime ^application/x-javascript.*mod_gzip_item_exclude mime ^image/.*mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*</ifModule># BEGIN Expire headers<ifModule mod_expires.c>ExpiresActive OnExpiresDefault "access plus 5 seconds"ExpiresByType image/x-icon "access plus 12592000 seconds"ExpiresByType image/jpeg "access plus 12592000 seconds"ExpiresByType image/png "access plus 12592000 seconds"ExpiresByType image/gif "access plus 12592000 seconds"ExpiresByType application/x-shockwave-flash "access plus 12592000 seconds"ExpiresByType text/css "access plus 1604800 seconds"ExpiresByType text/javascript "access plus 1216000 seconds"ExpiresByType application/javascript "access plus 1216000 seconds"ExpiresByType application/x-javascript "access plus 1216000 seconds"ExpiresByType text/html "access plus 111600 seconds"ExpiresByType application/xhtml+xml "access plus 111600 seconds"</ifModule># END Expire headers# BEGIN Cache-Control Headers<ifModule mod_headers.c><filesMatch "\.(ico|jpe?g|png|gif|swf)$">Header set Cache-Control "public"</filesMatch><filesMatch "\.(css)$">Header set Cache-Control "public"</filesMatch><filesMatch "\.(js)$">Header set Cache-Control "private"</filesMatch><filesMatch "\.(x?html?|php)$">Header set Cache-Control "private, must-revalidate"</filesMatch></ifModule># END Cache-Control Headers########## Begin - ETag Optimization## This rule will create an ETag for files based only on the modification## timestamp and their size.## Note: It may cause problems on your server and you may need to remove itFileETag MTime Size# AddOutputFilterByType is now deprecated by Apache. Use mod_filter in the future.AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript# Enable expiration controlExpiresActive On# Default expiration: 1 hour after requestExpiresDefault "now plus 1 hour"# CSS and JS expiration: 1 week after requestExpiresByType text/css "now plus 1 week"ExpiresByType application/javascript "now plus 1 week"ExpiresByType application/x-javascript "now plus 1 week"# Image files expiration: 1 month after requestExpiresByType image/bmp "now plus 1 month"ExpiresByType image/gif "now plus 1 month"ExpiresByType image/jpeg "now plus 1 month"ExpiresByType image/jp2 "now plus 1 month"ExpiresByType image/pipeg "now plus 1 month"ExpiresByType image/png "now plus 1 month"ExpiresByType image/svg+xml "now plus 1 month"ExpiresByType image/tiff "now plus 1 month"ExpiresByType image/vnd.microsoft.icon "now plus 1 month"ExpiresByType image/x-icon "now plus 1 month"ExpiresByType image/ico "now plus 1 month"ExpiresByType image/icon "now plus 1 month"ExpiresByType text/ico "now plus 1 month"ExpiresByType application/ico "now plus 1 month"ExpiresByType image/vnd.wap.wbmp "now plus 1 month"ExpiresByType application/vnd.wap.wbxml "now plus 1 month"ExpiresByType application/smil "now plus 1 month"# Audio files expiration: 1 month after requestExpiresByType audio/basic "now plus 1 month"ExpiresByType audio/mid "now plus 1 month"ExpiresByType audio/midi "now plus 1 month"ExpiresByType audio/mpeg "now plus 1 month"ExpiresByType audio/x-aiff "now plus 1 month"ExpiresByType audio/x-mpegurl "now plus 1 month"ExpiresByType audio/x-pn-realaudio "now plus 1 month"ExpiresByType audio/x-wav "now plus 1 month"# Movie files expiration: 1 month after requestExpiresByType application/x-shockwave-flash "now plus 1 month"ExpiresByType x-world/x-vrml "now plus 1 month"ExpiresByType video/x-msvideo "now plus 1 month"ExpiresByType video/mpeg "now plus 1 month"ExpiresByType video/mp4 "now plus 1 month"ExpiresByType video/quicktime "now plus 1 month"ExpiresByType video/x-la-asf "now plus 1 month"ExpiresByType video/x-ms-asf "now plus 1 month"
Thấy cái này ảo thế bác, ko phải cài gì vào bộ code à? cứ thế để chạy thôi thì có duy trì đc ko? sao bác ko cho ít rì view cụ thể luôn với hướng dẫn nhỉ
quên mất chưa chèn thêm mã cho bác....sorry đợi chút http://thaibinhweb.com/chia-se/154-...-website-va-tang-diem-pagespeed-insights.html
Bác cho cái link mà sao lại phải để link rút gon thế kia? Mất công chia sẻ thì để công khai full url đi bạn, những cái bác chia sẻ google speed cũng bảo em nhu thế, hài
em gửi link ở dưới đó bác.....link trên nhé....bac check lại xem........ http://thaibinhweb.com/chia-se/154-...-website-va-tang-diem-pagespeed-insights.html
bác đang chỉ cách tối ưu cho wordpress hả. hiện tại trang test page speed của google nó có chỉ ra các lỗi cần sửa cho mình mà, chịu khó translate rồi nhờ bên code chỉnh lại theo đó là được
à mã này dùng cho nhiều loại ....bạn dùng thử xem sao........ bắt viết 150 ký tự cơ à......hic hic load cực nhanh nè http://camerahungha.com/......................
Bác có phần mềm nào nén ảnh tốt không vậy? site mình nhiều ảnh dung lượng cao quá nên tốc độ load chậm, đang tìm cách giảm xuống mà chưa tìm được phần mềm nào cả.
Mình hay dùng cái này.................khá ổn bạn nhé....FILEminimizer Pictures Bạn down về nén thử xem nhé.................. phải viết đủ 150 ký tự à ..............................
Cái này chủ thớt đưa ra là đúng nhưng nó cũng có 2 mặt của nó, mình xin chia sẻ để mọi người rút kinh nghiệm hơn nữa nhé. Những câu lệnh trên để chỉ định rằng nén và lưu vào bộ nhớ cache của trình duyệt những file mà nó quy định, thời gian giản phóng bộ nhớ cache để load lại các file đó .v.v. để nếu ai đó đã vào trang đó 1 lần rồi thì từ lần thứ 2 trong khoảng thời gian mà chưa giải phóng bộ nhớ cache nó sẽ không phải load lại trực tiếp từ server về nữa mà lấy thông tin từ trình duyệt. Như vậy với những người quản trị phải thận trọng, nội dung bài OK rồi và hãy kiểm tra kỹ lại hãy post lên vì post lên rồi và có khách vào rồi thì nó đã lưu thông tin trên máy của khách, admin có sửa lại thì trên máy khách nó cũng không thay đổi, nếu muốn thay đổi thì khách phải xóa bộ nhớ cache trên trình duyệt đi mới thấy hoặc chờ đến hết thời gian lưu bộ nhớ cache. hi hi hi trang http://hatchongam.com của mình còn đặt tới 94/100 cho bản di động và 95/100 cho bản desktop cơ chứ không chỉ có 70-90 như thớt đâu thớt à!