Hướng dẫn tăng tốc cho Opencart bằng cách tối ưu hóa bộ nhớ cache

Posted by admin 07/11/2015 94 Comment(s) Thủ thuật,

Như chúng ta đã biết, về cơ bản tất cả các tệp tin trên trang web của bạn sử dụng (jpg, gif, css, js …) cần cho máy chủ của bạn biết lưu trữ thông tin các tệp này bao lâu trước khi kiểm duyệt một tệp tin mới. Nếu các bạn không cho trình duyệt biết một khoảng thời gian của bộ nhớ cache thì trình duyệt sẽ tạo ra một bản sao mới của mỗi tệp tin sau mỗi lần load trang, như vậy có nghĩa rằng trang của bạn sẽ sử dụng nhiều băng thông hơn mỗi khi tải lại trang (F5) và cũng mất nhiều thời gian hơn để tải.

Google đã khuyến cáo nên để các tệp tin được lưu trữ ít nhất một tháng, đây là một khoảng thời gian dài, như vậy nếu trang web của bạn không có nhiều thay đổi thì các bạn nên để bộ nhớ cache ít nhất là 1 tháng, nếu trang của bạn có nhiều thay đổi thì nên để nó lớn hơn 24 giờ.

Để tăng tốc cho Opencart bằng cách tối ưu hóa bộ nhớ cache các bạn thêm code sau vào tệp tin .htaccess:

# Turn on Expires and set default to 0
ExpiresActive On
ExpiresDefault A0
 
# Set up caching on media files for 5 weeks
<FilesMatch ".(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav)$">
ExpiresDefault A3024000
Header append Cache-Control "public"
</FilesMatch>
 
# Set up caching on media files for 5 weeks
<FilesMatch ".(gif|jpg|jpeg|png|swf)$">
ExpiresDefault A3024000
Header append Cache-Control "public"
</FilesMatch>
 
# Set up 1 day caching on commonly updated files
\<FilesMatch ".(xml|txt|html|js|css)$">
ExpiresDefault A86400
Header append Cache-Control "proxy-revalidate"
</FilesMatch>

# Force no caching for dynamic files
<FilesMatch ".(php|cgi|pl|htm)$">
ExpiresActive Off
Header set Cache-Control "private, no-cache, no-store, proxy-revalidate, no-transform"
Header set Pragma "no-cache"
</FilesMatch>

Lưu tập tin .htaccess lại và nhấn F5 website Opencart của bạn để cảm nhận sự thay đổi nhé !

Nguồn: Opencart84

94 Comment(s)

AbWBLmMq:
18/10/2024, 04:41:07 AM, www.example.com
Reply

1

AbWBLmMq:
18/10/2024, 04:42:23 AM, www.example.com
Reply

1

Barbara Lopez:
03/10/2025, 09:50:41 PM, levited.com
Reply

Way cool! Some very valid points! I appreciate you penning this post and also the rest of the site is also very good.

Katherine Bowman:
07/10/2025, 12:33:34 AM, antibact.sbs
Reply

Take the PNY DUO-Link for iPhone &amp; iPad for example, a fantastic data storage card which plugs into an Apple Lightning connector conectado one side and a standard USB conectado the other.

Katherine Bowman:
07/10/2025, 03:51:55 AM, antibact.sbs
Reply

Take the PNY DUO-Link for iPhone &amp; iPad for example, a fantastic data storage card which plugs into an Apple Lightning connector conectado one side and a standard USB conectado the other.

Donna Webb:
10/10/2025, 03:36:24 AM, dapoxetined.org
Reply

Hi! Do you know if they make any plugins to safeguard against hackers? I'm kinda paranoid about losing everything I've worked hard on. Any recommendations?

Jasmine Jackson:
10/10/2025, 03:25:19 PM, amoxibest.top
Reply

Thanks for helping out, great information.

Justin Ward:
11/10/2025, 12:41:27 AM, medshop24h.top
Reply

continuously i used to read smaller articles or reviews that also clear their motive, and that is also happening with this paragraph which I am reading at this place.

Matthew Powell:
11/10/2025, 08:57:33 PM, tadalah.com
Reply

I could not resist commenting. Exceptionally well written!

Eric Morton:
12/10/2025, 04:54:37 AM, sildenafiil.cc
Reply

Ahaa, its fastidious conversation on the topic of this post here at this weblog, I have read all that, so now me also commenting at this place.

Tonya Farmer:
12/10/2025, 04:05:37 PM, propeciaa.sbs
Reply

Just hover the mouse for the few seconds within the video file and you are going to be able to discover the size. This can service one of the most vehicles, but it can be difficult setting and police a charging policy.

Yolanda Morrow:
12/10/2025, 10:33:34 PM, sildenaguide.com
Reply

Ahaa, its good dialogue regarding this paragraph here at this web site, I have read all that, so now me also commenting at this place.

Morgan Burns DDS:
28/10/2025, 02:15:00 AM, zithromax24h.sbs
Reply

Greetings! Very helpful advice within this post! It's the little changes that will make the most important changes. Thanks a lot for sharing!

Jennifer Gonzalez:
29/10/2025, 07:34:32 AM, kamagras.shop
Reply

I will immediately take hold of your rss as I can not find your e-mail subscription link or e-newsletter service. Do you have any? Kindly permit me understand so that I may subscribe. Thanks.

Robert Ortiz:
07/11/2025, 02:58:04 AM, sildenawin.shop
Reply

I’ll right away seize your rss feed as I can’t to find your email subscription link or newsletter service. Do you’ve any? Please let me recognise so that I may subscribe. Thanks.

Michaela Higgins:
07/11/2025, 06:16:46 PM, kamagradirect.shop
Reply

Hi there, I rezd yor blo liuke every week. Yourr writinng styke iis awesome, keerp up tthe good work!

Tricia Moore MD:
09/11/2025, 05:20:12 PM, tadalix.shop
Reply

It's very straightforward to find out any matter on web as compared to books, as I found this paragraph at this website.

Rebekah Daniels:
13/11/2025, 11:12:33 PM, ivermactin.sbs
Reply

I just could not leave your web site before suggesting that I extremely enjoyed the usual information an individual provide for your visitors? Is gonna be back ceaselessly to inspect new posts

Mark Webb:
28/11/2025, 07:13:27 AM, avanafil.online
Reply

Wow, this post is good, my younger sister is analyzing such things, thus I am going to tell her.

Keith Hurst:
28/11/2025, 08:24:22 PM, bupropion150mg.shop
Reply

It's very effortless to find out any topic on net as compared to books, as I found this paragraph at this site.

Kaylee Wilkerson:
30/11/2025, 07:35:29 AM, acyclovir-400-mg.store
Reply

Ahaa, its good dialogue regarding this article here at this weblog, I have read all that, so at this time me also commenting at this place.

Maria Campos:
03/12/2025, 07:03:55 PM, playastronaut.cc
Reply

What’s up, just wanted to tell you, I loved this article. It was helpful. Keep on posting!

James Nguyen:
06/12/2025, 07:51:19 PM, zolomeds.shop/zoloft-for-sale.html
Reply

I like what you guys are up too. This sort of clever work and reporting! Keep up the wonderful works guys I've added you guys to my own blogroll.

Jason Jones:
07/12/2025, 05:12:00 AM, fluco.store/fluconazole-tablet.html
Reply

I am sure this post has touched all the internet people, its really really fastidious piece of writing on building up new web site.

Grace Reed:
08/12/2025, 11:11:25 PM, furocare.online/furosemide-lasix.html
Reply

There's certainly a lot to find out about this subject. I like all the points you have made.

Brittany Heath:
Reply

I will immediately grab your rss feed as I can’t find your email subscription hyperlink or newsletter service. Do you’ve any? Kindly let me realize so that I could subscribe. Thanks.

Christina Cochran:
30/01/2026, 10:37:13 PM, medshop24h.top/tetracycline
Reply

Hello! I've been following your blog for a while now and finally got the courage to go ahead and give you a shout out from Huffman Tx! Just wanted to tell you keep up the good work!

David Castaneda:
31/01/2026, 05:50:40 AM, propeciaa.sbs
Reply

I’ll right away grab your rss as I can not in finding your email subscription hyperlink or newsletter service. Do you’ve any? Please let me recognize so that I could subscribe. Thanks.

Pamela Love:
Reply

I enjoy what you guys are up too. Such clever work and coverage! Keep up the superb works guys I've incorporated you guys to my blogroll.

Samantha West:
02/02/2026, 01:28:06 AM, kamagras.shop/vardenafil
Reply

There is definately a lot to find out about this issue. I like all the points you’ve made.

Alexis Guzman:
02/02/2026, 11:29:01 PM, bluepillpoint.shop
Reply

Amazing! This blog looks exactly like my old one! It's on a totally different topic but it has pretty much the same page layout and design. Excellent choice of colors!

Victoria Jensen:
04/02/2026, 07:50:19 PM, metamedline.shop
Reply

Hi there i am kavin, its my first time to commenting anyplace, when i read this article i thought i could also create comment due to this brilliant piece of writing.

Michael Hatfield:
05/02/2026, 11:32:58 PM, gastromedix.shop/mebeverine.html
Reply

I am sure this post has touched all the internet visitors, its really really good piece of writing on building up new web site.

Theresa Jackson:
14/02/2026, 05:15:14 AM, arthromedix.online/indomethacin.html
Reply

Hi, after reading this amazing article i am also cheerful to share my knowledge here with colleagues.

Emily Hamilton:
14/02/2026, 06:24:46 PM, minoximed.online
Reply

Excellent post. I certainly love this website. Stick with it!

Jessica Parker:
08/04/2026, 07:35:24 PM, medshop24h.top/lamotrigine
Reply

Step 4. Now open the Mi PC Suite acessível your windows and you will see your phone on the App screen with a connected message.

Christopher Johnson:
10/04/2026, 07:10:55 AM, gastromedix.shop/misoprostol.html
Reply

I love it when individuals come together and share views. Great site, stick with it!

Anthony Newton:
14/04/2026, 06:54:05 AM, edmedix.com
Reply

I visited many websites however the audio feature for audio songs present at this web page is really fabulous.

Nancy Taylor:
14/04/2026, 08:14:05 PM, tadaline.com
Reply

Hey there! I've been following your weblog for some time now and finally got the bravery to go ahead and give you a shout out from Porter Tx! Just wanted to tell you keep up the good job!

David Rodriguez:
16/04/2026, 05:55:20 AM, edmedix.com/viagra.html
Reply

Greetings! Very useful advice in this particular post! It is the little changes that make the largest changes. Many thanks for sharing!

Brianna Cortez:
16/04/2026, 05:44:03 PM, edmedix.com/viagra-pills.html
Reply

I will right away take hold of your rss as I can not find your e-mail subscription hyperlink or e-newsletter service. Do you have any? Please allow me recognise in order that I could subscribe. Thanks.

Adam Gordon:
17/04/2026, 03:44:45 AM, edmedix.com/sildenafil-citrate.html
Reply

Ahaa, its fastidious dialogue about this piece of writing at this place at this website, I have read all that, so at this time me also commenting at this place.

Melissa Brown:
17/04/2026, 08:49:10 AM, cilalisez.com
Reply

Pretty great post. I simply stumbled upon your blog and wanted to mention that I have truly loved browsing your blog posts. In any case I'll be subscribing on your rss feed and I'm hoping you write again soon!

Chad Black:
17/04/2026, 01:43:17 PM, edmedix.com/kamagra.html
Reply

I will right away clutch your rss feed as I can not to find your email subscription hyperlink or newsletter service. Do you’ve any? Please permit me recognise so that I may subscribe. Thanks.

Kimberly King:
17/04/2026, 06:21:23 PM, kamagras.shop/zudena
Reply

I’ll right away grab your rss feed as I can’t in finding your e-mail subscription hyperlink or e-newsletter service. Do you have any? Please let me recognize in order that I may just subscribe. Thanks.

Paula Roman:
18/04/2026, 02:01:45 AM, cilalisez.com/cialis-generic.html
Reply

Remarkable! Its genuinely amazing piece of writing, I have got much clear idea about from this post.

Kerry Smith:
18/04/2026, 01:26:29 PM, edmedix.com/viagra-for-men.html
Reply

Hi, I do think this is an excellent blog. I stumbledupon it ;) I will come back once again since i have bookmarked it. Money and freedom is the greatest way to change, may you be rich and continue to help others.

Kristen Davis:
18/04/2026, 06:18:12 PM, cilalisez.com/tadalafil-20mg.html
Reply

There's certainly a great deal to learn about this subject. I like all of the points you have made.

William Miller:
19/04/2026, 05:40:01 AM, edmedix.com/viagra-generic.html
Reply

I visited several websites however the audio feature for audio songs existing at this website is really marvelous.

Melanie Perez:
Reply

This is a topic that's near to my heart... Thank you! Where are your contact details though?

Amy Smith:
21/04/2026, 12:19:37 AM, cenforce.online
Reply

Ahaa, its pleasant conversation about this paragraph at this place at this website, I have read all that, so now me also commenting here.

Frank Gonzalez:
21/04/2026, 06:12:10 AM, vidalisted.shop
Reply

Ahaa, its nice discussion concerning this article here at this blog, I have read all that, so now me also commenting here.

Ryan Gonzales:
22/04/2026, 01:53:20 AM, voriconazole.online
Reply

Ahaa, its nice dialogue on the topic of this article here at this web site, I have read all that, so at this time me also commenting here.

Donna Petty:
22/04/2026, 06:17:43 AM, orlistate.online
Reply

I am sure this post has touched all the internet visitors, its really really fastidious paragraph on building up new webpage.

Roger Howard:
24/04/2026, 08:08:14 PM, cilalisez.com/tadalafil-5mg.html
Reply

I like it when people get together and share ideas. Great blog, continue the good work!

Colleen Ford:
25/04/2026, 06:50:41 AM, fluco.store/fluconazole-200-mg.html
Reply

Ahaa, its nice conversation about this piece of writing at this place at this website, I have read all that, so now me also commenting at this place.

Adam Thompson:
25/04/2026, 12:15:50 PM, edpharmahub.com
Reply

Thanks , I've just been searching for information about this topic for a long time and yours is the best I have found out so far. However, what about the bottom line? Are you positive in regards to the source?

Sharon Quinn:
25/04/2026, 06:32:26 PM, cenforce.online/cenforce-100mg.html
Reply

I wanted to thank you for this fantastic read!! I certainly enjoyed every little bit of it. I have you bookmarked to look at new things you

Alexander Smith:
25/04/2026, 11:01:07 PM, cilalisez.com/cialis.html
Reply

Ahaa, its pleasant dialogue about this post at this place at this website, I have read all that, so now me also commenting at this place.

Michael Matthews:
27/04/2026, 05:06:48 AM, cenforce.online/cenforce-200.html
Reply

I need to to thank you for this good read!! I absolutely loved every bit of it. I've got you book-marked to check out new things you

Scott Rodriguez:
28/04/2026, 07:01:58 PM, edpharmahub.com/viagra
Reply

Cool blog! Is your theme custom made or did you download it from somewhere? A theme like yours with a few simple adjustements would really make my blog jump out. Please let me know where you got your theme. Bless you

Todd Valdez II:
04/05/2026, 11:08:29 PM, cilalisez.com/tadalafil-generic.html
Reply

Hi, I do think this is a great website. I stumbledupon it ;) I may return yet again since i have book-marked it. Money and freedom is the best way to change, may you be rich and continue to guide others.

Scott Aguilar:
05/05/2026, 07:54:43 AM, edpharmahub.com/sildenafil
Reply

There's definately a lot to learn about this issue. I really like all of the points you made.

Mark Baker:
05/05/2026, 04:26:54 PM, cenforce.online/cenforce-100.html
Reply

I will right away grab your rss as I can not find your e-mail subscription hyperlink or newsletter service. Do you have any? Please let me recognize so that I could subscribe. Thanks.

Carlos Gregory:
06/05/2026, 01:04:47 AM, cilalisez.com/tadalafil-10mg.html
Reply

Thank you a lot for sharing this with all people you really understand what you're talking about! Bookmarked. Kindly also seek advice from my site =). We could have a link trade contract among us!

Karen Davis:
06/05/2026, 09:38:16 AM, vidalisted.shop/vidalista-20.html
Reply

Way cool! Some extremely valid points! I appreciate you penning this post and the rest of the site is very good.

Sarah Snyder:
06/05/2026, 07:24:47 PM, edpharmahub.com/abhigra
Reply

Ahaa, its pleasant discussion on the topic of this piece of writing here at this webpage, I have read all that, so at this time me also commenting at this place.

Christopher Ortiz:
07/05/2026, 12:34:18 AM, cenforce.online/cenforce-150.html
Reply

There's definately a great deal to know about this issue. I love all of the points you've made.

William Gutierrez:
07/05/2026, 10:12:57 AM, edpharmahub.com/avanafil
Reply

There's certainly a great deal to learn about this topic. I love all of the points you have made.

James Miranda:
07/05/2026, 08:37:11 PM, cilalisez.com/tadalafil-20-mg.html
Reply

These are actually wonderful ideas in regarding blogging. You have touched some good points here. Any way keep up wrinting.

Tracie Parker:
08/05/2026, 11:53:18 AM, edpharmahub.com/cenforce
Reply

Howdy! Someone in my Facebook group shared this website with us so I came to give it a look. I'm definitely loving the information. I'm bookmarking and will be tweeting this to my followers! Excellent blog and great design.

Vanessa Davis:
09/05/2026, 04:10:05 PM, cenforce.online/cenforce-200mg.html
Reply

I’ll right away grasp your rss feed as I can’t in finding your e-mail subscription hyperlink or newsletter service. Do you’ve any? Kindly let me realize so that I could subscribe. Thanks.

Teresa Gibbs:
12/05/2026, 05:35:10 PM, slimgogo.com
Reply

I'm not sure why but this weblog is loading incredibly slow for me. Is anyone else having this problem or is it a problem on my end? I'll check back later on and see if the problem still exists.

Nicholas Garcia:
13/05/2026, 06:29:02 PM, edpharmahub.com/dapoxetine
Reply

This is a topic which is close to my heart… Best wishes! Where are your contact details though?

Jessica Chandler:
14/05/2026, 07:48:55 AM, slimgogo.com/de
Reply

I’ll immediately grab your rss feed as I can’t find your e-mail subscription hyperlink or e-newsletter service. Do you have any? Kindly allow me recognize in order that I may subscribe. Thanks.

Lisa Cooper:
14/05/2026, 03:29:23 PM, edpharmahub.com/kamagra
Reply

Greetings! I've been reading your web site for a while now and finally got the courage to go ahead and give you a shout out from Porter Texas! Just wanted to say keep up the excellent job!

Karina Dominguez:
17/05/2026, 07:06:01 PM, edpharmahub.com/levitra
Reply

Some really nice stuff on this internet site, I love it.

Kaitlin Nelson:
18/05/2026, 02:42:51 AM, edpharmahub.com/revatio
Reply

Hi! I've been following your site for a long time now and finally got the courage to go ahead and give you a shout out from Atascocita Tx! Just wanted to say keep up the fantastic work!

Melissa Thomas:
18/05/2026, 08:35:15 AM, edpharmahub.com/stendra
Reply

I visited multiple sites but the audio quality for audio songs present at this website is in fact marvelous.

Crystal Davies:
18/05/2026, 06:36:23 PM, edpharmahub.com/tadalafil
Reply

Hi there it's me, I am also visiting this web page regularly, this website is in fact nice and the viewers are genuinely sharing good thoughts.

Tricia Williams:
19/05/2026, 12:18:40 AM, edpharmahub.com/vardenafil
Reply

I visited several websites except the audio quality for audio songs present at this web site is truly excellent.

Aaron Sullivan:
19/05/2026, 08:18:41 AM, edpharmahub.com/vidalista
Reply

I like it whenever people come together and share opinions. Great website, continue the good work!

Bobby Franklin:
19/05/2026, 01:47:35 PM, edpharmahub.com/zudena
Reply

Hi there, I discovered your site by means of Google whilst looking for a comparable topic, your web site came up, it looks great. I have bookmarked it in my google bookmarks.

Eric Gray:
19/05/2026, 07:02:51 PM, easyslimnow.com
Reply

I am sure this paragraph has touched all the internet visitors, its really really nice piece of writing on building up new weblog.

Justin Walker:
20/05/2026, 12:20:03 AM, doxyatlas.com
Reply

Hi there to every one, since I am actually keen of reading this website's post to be updated on a regular basis. It includes nice material.

Cassandra Burns:
20/05/2026, 05:56:59 AM, rehairhub.com
Reply

For most recent information you have to visit internet and on the web I found this web site as a most excellent site for newest updates.

Bianca Ortega:
20/05/2026, 03:16:44 PM, slimgogo.com/es
Reply

It's very easy to find out any topic on web as compared to books, as I found this article at this web page.

Christopher Murphy:
21/05/2026, 08:16:40 AM, easyslimnow.com/orlistat
Reply

There is obviously a lot to realize about this. I believe you made certain nice points in features also.

Lori Brooks:
21/05/2026, 03:52:46 PM, rehairhub.com/avodart
Reply

This is very interesting, You are an overly skilled blogger. I've joined your feed and sit up for in quest of extra of your great post. Also, I've shared your site in my social networks

Daniel Wilson:
21/05/2026, 11:22:13 PM, easyslimnow.com/ozempic
Reply

I simply couldn't leave your site prior to suggesting that I extremely loved the usual information an individual supply on your guests? Is gonna be back steadily in order to check out new posts

Ryan Mccormick:
22/05/2026, 08:59:42 PM, doxyatlas.com/cheap-doxycycline
Reply

It's very easy to find out any topic on web as compared to books, as I found this paragraph at this site.

Ashley Combs:
24/05/2026, 07:40:32 AM, doxyatlas.com/doxycycline
Reply

I’ll right away grab your rss feed as I can not find your email subscription hyperlink or e-newsletter service. Do you have any? Please permit me understand so that I may subscribe. Thanks.

Mark Lynch:
24/05/2026, 05:26:50 PM, rehairhub.com/minoxidil
Reply

Hi there! I simply want to give you a huge thumbs up for the excellent information you have right here on this post. I will be coming back to your blog for more soon.

Edward Savage:
25/05/2026, 05:46:12 AM, easyslimnow.com/semaglutide
Reply

I will immediately seize your rss feed as I can not find your email subscription hyperlink or e-newsletter service. Do you have any? Please allow me recognize so that I could subscribe. Thanks.

Write a Comment