Leverage Browser Caching in WordPress via .HTA Access

Is your site is going slow, and you are not able to figure it out why it so.

There are plenty of reasons your site may load slow, which is not good at all. The first thing you should do is to check your website status in and get a full report from GTMetrix.

Below is one of the website report for instance. As you can see Leverage browser caching is in red. And it is not ideal at all. An immediate action has to be performed to get it normal.

Leverage Browser Caching in wordpress

If you too got such kind of result and want to fix this error and boost the speed of your website, then read on. This article is definitely for you.

Before solving this issue, it’s good to know how Leverage Browser Caching actually processes with your web browser.

What is Leverage Browser Caching and how it works

When a webmaster self-defines how the resources of their website should perform on the reader’s browsers. Whether it could be text data, images, scripts, CSS or any which is being served by a web page. This entire process performed by the webmaster is leverage browser caching.

That means while the user visits the web page for the first time. All the unchanged text data, images cached or stored in their web browser.

Doing this the visitor will have better user experience going forward with your website as the website will load much faster. Because the browser doesn’t have to load the entire website every time.

Sounds cool? Let’s us get into action.

Useful Read: How To Limit Post Revisions in WordPress from WP-Config

Leverage Browser Caching in WordPress via .hta access

The process of browser caching in WordPress without a plugin is also quite easy. All we need to do is, drop a small piece of code in the root file in WordPress i.e .hta access.

Step 1. Login to your Hosting Cpanel.

Step 2. Look for the File Manager and Click on it. This will open all the files of your WordPress website.

Leverage Browser Caching in wordpress

Step 3.  Navigate to the public_html folder, and find the file named as .hta access from the right pane.

Step 4. Select the .hta access and right-click on it and then select Code Edit. This will open a window, where you can add the code for caching.

Note: It’s wise to take a backup of the .hta access file before doing any changes to it to be on a safer side.

Step 5. Scroll the window containing the code till bottom and paste the below code at the end.

## Expires Header Caching ##

ExpiresActive On
ExpiresByType image/jpg “access 1 year”
ExpiresByType image/jpeg “access 1 year”
ExpiresByType image/gif “access 1 year”
ExpiresByType image/png “access 1 year”
ExpiresByType text/css “access 1 month”
ExpiresByType application/pdf “access 1 month”
ExpiresByType application/javascript “access 1 month”
ExpiresByType application/x-javascript “access 1 month”
ExpiresByType application/x-shockwave-flash “access 1 month”
ExpiresByType image/x-icon “access 1 year”
ExpiresDefault “access 2 days”

## Expires Header Caching ##

Check the image for better insights., how it should look on your .hta access file.

 Leverage Browser Caching in wordpress

Step 6. Hit the Save Changes Button.

There you go, you are all done with the setup. And successfully added the leverage browser caching for your website.

Now the visitors will be able to see your site loads much faster than before. For testing the same, you can head over back to GTMetrix. A score of 70+is an ideal for any WordPress website.

You can also achieve a good page loading speed by leverage browser caching using the W3TotalCache plugin.

Also Read: Best Way To Cleanup WordPress Database to (SpeedUp Website)

8

Don't Hesitate, Leave a Reply...!

Notify of
avatar
Sort by:   newest | oldest
wpDiscuz
Questioncage

Subscribe To QuestionCage

Glad to see your Visit at QuestionCage!

One more step to connect ahead "Subscribe to Us" and get the updates to your inbox directly.

You have Successfully Subscribed to QuestionCage!

2 Shares
Share
+1
Tweet
Stumble