WordPress cache leverage no plugin browser loading faster .htaccess

Do you want to add caching to your WordPress website easy way you can follow this simple steps on your site caching is a way to make your website faster, browser store all data cache files, so that they don’t have to be downloaded again all this means in short loading time data already store to user browser that can make them load faster and speed up your WordPress site. Let’s speed up and optimize your WordPress website right now.

Step 1: Test your Website Speed

First you want your website speed result as a percentage, this is very important because before this all steps you know your website speed and performance. Test your site on Google PageSpeed Insights to view your current score.

Step 2: Open up your .htaccess file

Find .htaccess file on located in the root directory of your website, now you are in root directory (if NOT FOUND .htaccess file – satay same location → go top right side → find setting → check ‘Show all hidden files’ ). Now you can access .htaccess file click and edit.

Step 3: Edit .htaccess file

You can copy all the codes bellow and paste it on .htaccess file. To set the expiry time of resources such as images, html, javaScript, CSS files requires a slight modification to your file. Set these values as long as it makes sense for your site – 1 month is typically good enough.

#Customize expires caching start - adjust the period according to your needs
<IfModule mod_expires.c>
  FileETag MTime Size
  AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript
  ExpiresActive On
  ExpiresByType text/html "access 600 seconds"
  ExpiresByType application/xhtml+xml "access 600 seconds"
  ExpiresByType text/css "access 1 month"
  ExpiresByType text/javascript "access 1 month"
  ExpiresByType text/x-javascript "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 application/pdf "access 1 month"
  ExpiresByType image/x-icon "access 1 year"
  ExpiresByType image/jpg "access 1 year"  
  ExpiresByType image/jpeg "access 1 year"
  ExpiresByType image/png "access 1 year"
  ExpiresByType image/gif "access 1 year"
  ExpiresDefault "access 1 month"
#Expires caching end

# BEGIN Cache-Control Headers
<IfModule mod_expires.c>
  <IfModule mod_headers.c>
    <filesMatch "\.(ico|jpe?g|png|gif|swf)$">
      Header append Cache-Control "public"  
    <filesMatch "\.(css)$">
      Header append Cache-Control "public"
    <filesMatch "\.(js)$">
      Header append Cache-Control "private"
    <filesMatch "\.(x?html?|php)$">
      Header append Cache-Control "private, must-revalidate"

# Disable ETags
<IfModule mod_headers.c>
	Header unset ETag

Step 4: Test Again your Website Speed

Retest your site on Google PageSpeed Insights to view your new score.

Resources I used. Consider following these tutorials to better improve your website speed and optimization. Above we’ve shown you a bunch of ways to implement to make sure you are able to leverage browser caching and make sure content that is downloaded is reused over and over again.

Other Popular Articles...

How jQuery Ajax Load WordPress Page Without Refresh

If you looking at how WordPress page, post page load fast using jQuery AJAX, no plugin request. There is an all details, how you implement to WordPress simply paste code correct location and boom website weather online server or local computer. So the best approach here is ... Read more →

jQuery Cookies Bar Form Set Cookie WordPress

Cookies Bar really easy especially when compared with regular Javascript but it is included the jQuery on WordPress site. This post shows how to set, get the value of and clear cookies remove cookies with jQuery, use this on WordPress users to implement and use easy. There ... Read more →

Notification Bar Without Plugin 1kb Simple Paste Code

Most of the cookie WordPress plugins consent unwanted script and code, final will slow down your site web performance, and website loading time boot download too many scripts and unwanted CSS and JavaScript. I found a single line of code paste it and work better than WordPress ... Read more →