Matt

Author Archives: Matt

After a career as a professional musician and band leader in the Miami South Florida Area I decided to see if I could make some money with this new internet thing. After years of trial and error I started to get the hang of it and now I am completely financially independent because of my various online businesses. The goal of this blog is to chronicle my continued marketing experiences. I focus on real examples of what works and what does not work. Google does not give us a recipe for getting our sites ranked. We have to use our own experiences to see what actually works rather than theory. I hope you enjoy the blog. Please let us know what you think in the comments area. We appreciate your feedback.

How to improve Google Page Speed Score in WordPress without Plugins?

 

The page loading speed of your website is the one important factor of your website’s success. You can have an amazing website with outstanding content to attract the visitors, but if your pages load slowly; then people goes to your competitor’s site. People don’t like to wait and Google loves fast web pages.

The Google Page speed insights help us to identify the ways to make the site speedy and mobile friendly. It provides you the score out of 100 and displays the list of recommendations.

Have you checked it for your website? Let’s check on: https://developers.google.com/speed/pagespeed/insights/

You may get results like this:

If your site is in WordPress, there are lots of plugins are available to improve the Page Speed.

But if you don’t want to use Plugins then also you can improve page speed score.

Let look how to solve Page Speed Problems without Plugins.

  1. Optimize Images

If your website contains images without compression, it shows “Optimize Images” recommendation.

Just replace all that images with compressed images. There are many free online image compressors available. The article 6 best free image compressor tools may help you to select one.

I recommend the kraken.io

You can use it for free. Choose the free web interface, enable lossless compression and upload images. And get your images compressed.

Replace the images and check your score. You will see the improvement in it.

Alternative:

There are WordPress plugins available which will optimize images for you. You don’t need to manually optimize images.

EWWW Image Optimizer, WPSmush, and Compress JPEG & PNG Images are the awesome for image compression.

  1. Leverage browser caching

You have to just set expiry dates to resolve this issue.

Add following code in .htaccess file and check your page speed score.

Code:

# Add Expire headers

<IfModule mod_expires.c>

<Filesmatch “\.(jpg|jpeg|png|gif|js|css|swf|ico|woff|mp3)$”>

ExpiresActive on

ExpiresDefault “access plus 30 days”

</Filesmatch>

</IfModule>

Alternative:

W3 Total Cache and WP Total Cache are the famous for leverage browser caching.

  1. Enable Compression

To enable the compression, you have to turn on GZIP or Deflate module.

Here, I have provided 3 alternatives and any one from these three and check your page speed score.

Code 1: GZIP Compression:

<ifModule mod_gzip.c>

mod_gzip_on Yes

mod_gzip_dechunk Yes

mod_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>

Code 2: Deflate Mode

<IfModule mod_deflate.c>

# Compress HTML, CSS, JavaScript, Text, XML and fonts

AddOutputFilterByType DEFLATE application/javascript

AddOutputFilterByType DEFLATE application/rss+xml

AddOutputFilterByType DEFLATE application/vnd.ms-fontobject

AddOutputFilterByType DEFLATE application/x-font

AddOutputFilterByType DEFLATE application/x-font-opentype

AddOutputFilterByType DEFLATE application/x-font-otf

AddOutputFilterByType DEFLATE application/x-font-truetype

AddOutputFilterByType DEFLATE application/x-font-ttf

AddOutputFilterByType DEFLATE application/x-javascript

AddOutputFilterByType DEFLATE application/xhtml+xml

AddOutputFilterByType DEFLATE application/xml

AddOutputFilterByType DEFLATE font/opentype

AddOutputFilterByType DEFLATE font/otf

AddOutputFilterByType DEFLATE font/ttf

AddOutputFilterByType DEFLATE image/svg+xml

AddOutputFilterByType DEFLATE image/x-icon

AddOutputFilterByType DEFLATE text/css

AddOutputFilterByType DEFLATE text/html

AddOutputFilterByType DEFLATE text/javascript

AddOutputFilterByType DEFLATE text/plain

AddOutputFilterByType DEFLATE text/xml

</IfModule>

Code 3: Deflate Mode (Optimized Code)

# BEGIN GZIP

<ifmodule mod_deflate.c>

AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript

</ifmodule>

# END GZIP

Aleternative:

W3 Total Cache will do it for you but if you want plugin specially for GZIP, then you can use Check and Enable GZIP Compression

  1. Eliminate Render-blocking JavaScript and CSS in above-the-fold content

Add following code in your function.php

// Adapted from https://gist.github.com/toscho/1584783

add_filter( ‘clean_url’, function( $url )

{

    if ( FALSE === strpos( $url, ‘.js’ ) )

    {

        return $url;

    }

    return “$url’ defer=’defer”;

}, 11, 1 );

OR add following code in header.php before </body>

<script type=”text/javascript”>

function downloadJSAtOnload() {

var element = document.createElement(“script”);

element.src = “defer.js”;

document.body.appendChild(element);

}

if (window.addEventListener)

window.addEventListener(“load”, downloadJSAtOnload, false);

else if (window.attachEvent)

window.attachEvent(“onload”, downloadJSAtOnload);

else window.onload = downloadJSAtOnload;

</script>

Alternative:

Want to use plugins for it? You can use Above the Fold Optimization, Autoptimize or W3 Total Cache for it

  1. Minify HTML, CSS and JavaScript

Serve minified HTML, CSS and JavaScripts to save many bytes of data and speed up download and parse times.

Tons of HTML, CSS and JS minifiers are available. Just minify using that minifiers and replace your original code with minified code.

Alternative:

Yeah….W3 Total Cache works for it also.

Alternative:

  1. Avoid Landing Page Redirects

The only solution for this is responsive web design. If your site has different URLs for desktop and mobile then this type of problem occurs, because redirects results in slow webpage loading speed.

Try to be Responsive ?

Bonus Tricks:

  1. Remove Query String from Static Resource

If you check your site on GTmetrix, you will get the recommendation for “Remove Query String from Static Resource”

To improve it, add following code in your function.php before closing the PHP tag.

function _remove_script_version( $src ){

$parts = explode( ‘?ver’, $src );

return $parts[0];

}

add_filter( ‘script_loader_src’, ‘_remove_script_version’, 15, 1 );

add_filter( ‘style_loader_src’, ‘_remove_script_version’, 15, 1 );

Alternative:

If you want to use plugin, you can use this.

  1. Use CDN (Content Delivery Network)

If you really want to give fast web experience to your users across the globe, then must use a CDN (Content Delivery Network). It helps to serve your website content speedily.

If you want free CDN, then CloudFlare is the best option. There is also a ton of other CDN also available.

Final Thought:

Page Speed is the really important factor for both user and search engine perspective. Don’t be lazzy by not optimizing your website speed. Just provide fast website to delight your visitors. They will love it!!

About Author:

Anjana Ratadiya works as an SEO Professional at Guru Technolabs – Web & Mobile App Development Company. She is crazy reader, good listener and passionate about SEO, Digital Marketing, WordPress and PHP. You can find Anjana on LinkedIN and Google+