SEO

How Optimize Website Speed Can Keep You Out of Trouble

If You Do Not (Do)optimize website speed Now, You Will Hate Yourself Later

In this article, you will read about optimize website speed tactics. So here you will read ways to improve website loading speed. Because slow site speed going to less traffic and low search engine ranking. Furthermore, site speed is a most important factor regarding search engine optimization.

Website Loading Speed Test

Now just read about website loading speed test. However, you can check your site speed from below given mediums. After it just optimizes website speed by the method, which will give you on next step.

Website Loading Speed Test

  • PageSpeed Insights
  • GT Metrix
  • Pingdom Site Speed Test

By accessing these sites you can check site’s speed like your main page or blog page. In fact, we mostly check static’s page speed because if your static page is giving good speed. Then obviously your site’s article pages will also be optimized and you don’t need to improve these ones individually.

Optimize Website Speed WordPress Tactics

Choose Best Hosting

Every expert says if you want a speedy site then prefer the best hosting. Because site speed depends on hosting company. If your site’s server will perform well. Then obviously you will get a good result from the search engine. However, if you are on the bad host and getting slow speed. Then you can make better with the help of CDN which will cover in next step.

My personal experience has passed with Pakish and Inmotion hosting and I did not satisfy from these companies. I have also discovered an article about server speed test which you can read here: Best Free CPanel Hosting.

Optimize Images for Making Site Speed Faster

If you see images optimization then it plays a big role making site speed faster. So let’s see how to optimize images while uploading or after uploading. According to the site’s speed report of 2016, 64 percent speed of a site depends on images. However you can use different sites for images optimization before uploading like as under:

“Optimizilla is a great site which is offering free services. You can upload the image and it will compress automatically. After it just download and enjoy”.

Use Photoshop for images Optimization

You can also optimize image using Photoshop also shown in below image.

Use Photoshop for images Optimization

Use Photoshop for images Optimization

Image Optimization With WordPress Plugin

If you are a user of WordPress then you can also use WordPress plugins for this purpose which are listed as under:

  • EWWW Image Optimizer
  • Smush Image Compression and Optimization
  • Optimus WordPress Plugin

According to Google, WebP images are better from PNG and JPEG. However, you can also paste the below code in your .htaccess file for image optimization. But keep in mind WebP will work only when a user will access your site using chrome or Opera browser.

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP_ACCEPT} image/webp
    RewriteCond %{DOCUMENT_ROOT}/$1.webp -f
    RewriteRule ^(path/to/your/images.+)\.(jpe?g|png)$ $1.webp [T=image/webp,E=accept:1]
</IfModule>

<IfModule mod_headers.c>
    Header append Vary Accept env=REDIRECT_accept
</IfModule>

AddType image/webp .webp
Less Usage of Plugins

Don’t use excessive quantity of plugins because it makes your site’s speed slower. Before installation of a plugin just check the active install and updated time. Because if any plugin did not update then it will create panic for you. So if necessary to use plugins then install those which showing active install more than 10,000.

Now just try to understand with the help of an example. If you want to use WordPress SEO pluginThen you can see on the web which is more active install. Like Yoast SEO plugin has +1 Million active install and WordPress Squirrelly has 20,000. Now I will suggest use Yoast SEO plugin. After it checks, is it updated? If yes then install and active it. Otherwise, you don’t need to take a risk by the installation of this type of plugins.

Cache Plugin Usage

Use cache plugin to optimize website speed. There are many free plugins are serving for this purpose like WP Super Cache, WP Fastest Cache or W3 Total Cache.

These are the three best free cache plugins which are using by WordPress users.

However, you can read configuration method for getting faster site speed by clicking on the below links:

If you have succeeded to configure according to above tutorials. Then check your website speed now I hope you are getting improvement. However, when I have checked then I improved from 18Sec 2Sec.

CDN Usage

If you want to give access to your visitors that they enjoy speedy website from any region. Then CDN is the best solution I have also published an article about it. By the way, if you have interest then click on this link: configure Cloud Flare Free CDN?

Furthermore, you can know the importance of CDN by comparing the below result which is with and without CDN.

Website Speed Test With and Without CDN

Note: The above result taken from Key CDN website just for telling the difference.

Don’t use Gravatar

Often the usage of Gravatar makes the cause of slow site speed. So it’s better to don’t show Gravatar. If you are using then disable this by the below showing method. Login to your main WP dashboard Setting » Discussion.

Don't-use-gravatar

Lazy Load Option Enable

Try to lazy load images many premium themes are offering built in option. But if your theme doesn’t have then you can use a plugin for this purpose.

Remove Revisions

Remove revisions is a better solution to optimize website speed. So you can remove revisions by using plugins but I will suggest removing by the below query. For this purpose, you need to log in your CPanel account.

  • After it trace phpMyAdmin.
  • Now select database where you want to remove revisions.
  • After it click on SQL tab.
  • Here place the below code and hit Go button. Furthermore, if you have changed table prefix then don’t forget to change prefix from query also. Otherwise, it will not work and give the error.
DELETE FROM wp_posts WHERE post_type = "revision";

Before doing work on database take backup and after it takes step. Because due to wrong coding you can lose your data. Keep in mind all data are available in your database like your posts etc. So save your work first and after it runs query.

However, if you are not interested. Then use a plugin but before optimize database with plugin take backup of your database.

Database Optimization

Another way to optimize website speed is database optimization. There are many plugins are available for this purpose but less usage of plugins are beneficial. You can optimize database using phpMyAdmin.

CSS and Javascript Minification

The purpose of CSS and Javascript minification to remove unnecessary characters. Like as below:

  • Removing white space
  • New line character removing
  • Comments
  • Delimiters blocking

It will reduce the amount of code requested by the server and will optimize website speed. However, if you are using WordPress then use WordPress cache enabler plugin for this purpose.

Gzip Compression Enable

You can also get a good speed by enabling Gzip compression. So for this purpose, you need to add the below code in your .htaccess file. Keep in mind if you are using cache plugin. Then you don’t need to enable Gzip compression code in your .htaccess file. Because when you are configuring just check the option and it will auto add code for enabling Gzip compression.

<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
  # Remove browser bugs (only needed for really old browsers)
  BrowserMatch ^Mozilla/4 gzip-only-text/html
  BrowserMatch ^Mozilla/4\.0[678] no-gzip
  BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
  Header append Vary User-Agent
</IfModule>
Nginx

If you are on Nginx then access nginx.conf and paste the below code.

gzip on;
gzip_comp_level 2;
gzip_http_version 1.0;
gzip_proxied any;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
gzip_disable "MSIE [1-6].(?!.*SV1)";
gzip_vary on;
Reduce HTTP Request

While fetching data from the server by browser excessive HTTP request make site’s speed slower. So try to reduce HTTP request to optimize website speed.

HTTP-Requests

However, you can use the below methods to minimize HTTP request size:

  • Inline Javascript
  • CSS Sprites usage
  • Leaving the usage of the third party plugins
  • Don’t use excessive coding
  • Combining CSS and JS files

Furthermore, you can remove HTTP request by the below example. Often Google analytics mostly used and people who don’t use Remarketing and Advertising also enable this mistakenly. So if you are not using this feature. Then disable this by accessing google analytics or placing the code in Google Analytics Script.

Remarketing-and-Advertising

ga('set', 'displayFeaturesTask', null);

Now you will not get HTTP request and the main script doesn’t have 302 redirect.

Now here see another example of removing 2nd HTTP request. By default, WordPress include the javascript file in the header “wp-emoji-release.min.js?ver=4.3.1”. And if you want to clean up then remove this by adding the below code in the function.php file. If you want to know how to access function.php?

/**
 * Disable the emoji's
 */
function disable_emojis() {
	remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
	remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
	remove_action( 'wp_print_styles', 'print_emoji_styles' );
	remove_action( 'admin_print_styles', 'print_emoji_styles' );	
	remove_filter( 'the_content_feed', 'wp_staticize_emoji' );
	remove_filter( 'comment_text_rss', 'wp_staticize_emoji' );	
	remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' );
	add_filter( 'tiny_mce_plugins', 'disable_emojis_tinymce' );
}
add_action( 'init', 'disable_emojis' );

/**
 * Filter function used to remove the tinymce emoji plugin.
 * 
 * @param    array  $plugins  
 * @return   array             Difference betwen the two arrays
 */
function disable_emojis_tinymce( $plugins ) {
	if ( is_array( $plugins ) ) {
		return array_diff( $plugins, array( 'wpemoji' ) );
	} else {
		return array();
	}
}

However, if you don’t want to use the manual method then use Disable Emojis Plugin” for this purpose.

Critical path and render blocking resources (CSS + JS)

While optimizing website speed you must need to know what files are blocking by DOM which is causing to slow site speed. It is known as “render blocking resources” like HTML, CSS, and Javascript. However, here some suggestions how to remove render blocking?

Suggestion about CSS
  • Call properly
  • Media queries usage
  • Make only one file or try to decrease the file’s amount if more than one
  • CSS minification by remove extra space, characters or comments etc.
  • Less usage of CSS

Suggestion about Javascript

  • Move javascript before </body> tag.
  • Always use Async.
  • Try to merge into one file
  • Javascript minification by removing white space, characters etc.
  • Try to inline it.

In fact, Async gives permission to download the script from the background without blocking. When it finish download rendering blocked and the script has executed. And when the script executes rendering resume. Lastly, you can defer javascript. It also works like Async.

Prefetch

DNS Prefetch another way to make speed faster. If I describe the definition then it will be difficult for beginners. So I am describing the concept of this technique. In fact, when we place code by access header.php. Then we inform the browser about the domain names. So now when a person accesses this from their browser. Then browser without calling DNS for knowing the IP address call your website on the front of the user.

<link rel="dns-prefetch" href="//www.example.com">
Upgrade to PHP7

Now if you want to optimize website speed then upgrade PHP version by the below method.

  • Access to your CPanel account.
  • Now trace for PHP configuration

Upgrade-PHP-Version

  • Click on PHP configuration and update to latest version.

Update-to-latest-version

Enable Hotlinking

You can enable hotlinking by placing the below code in your .htaccess file. It will prevent to other site’s owners to show your website’s images on their site. Furthermore, you can also enable this feature from your CPanel. But about it, you can ask from your hosting company.

RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?domain\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteRule .*\.(jpe?g|gif|bmp|png)$ http://i.imgur.com/donotsteal.gif [L]
404 error page not found Fix

When a URL disappear from a blog or website then it gives 404 error page not found. It does not affect site ranking. But it’s better to check Google webmaster tools for 404 error page not found and fix them. Furthermore, you can read here the method to fix 404 error page not found.

I will not suggest installing a plugin for checking 404 error pages. Because it makes the cause of excessive usage of CPU CPanel. You can setup 301 redirect or remove from Google index. Furthermore, you can check using Screaming Frog software or Online Broken Link Checker. Read here the best broken link checker tool.

Remove Plugins For Optimize Website Speed

Now just remove plugins which are causing slow site speed. You can install P3 Plugin or Web Performance Profiler. This is the way to check those plugins which are causing of slowing site speed. After checking just remove the plugins and optimize website speed.

Calculate Website Performance Budget

Now the turn to use a free tool which is famous with the name of “calculate your performance budget”. After accessing this site just select your connection speed.

performancebudget.io

Website Performance Budget

Furthermore, after proceeding you will get values of HTML, CSS, Javascript, Image, Video, Fonts. Lastly, you will get load time of different section which is also showing here as under:

Performance

Performance-Budget

Avoid Redirects

However, redirect is the best solution of 404 error page not found. But try to avoid 301 redirects because it doubles the load time of a site.

Summary

Lastly, you have seen different tactics for optimizing website speed. If you want to rank your website. Then try to make speed faster and after it checks site’s ranking on major search engines. If you face any difficulty to optimize website speed then leave a comment in the comment section.

Supporting Articles

Incredible Easy Method To Clean Up MySQL Database

Succeed With CPanel Fix File Permissions In 10 Minutes

Payments Are Currently On Hold By Google AdSense?

Show More

Global Blurb Team

“Global Blurb since 2015” Global Blurb providing information about SEO, Beauty, Health & Fitness, Interior designing, Fashion and ways of earning online without investing a penny. The blog designed to share ideas about different topics.

Want to contribute