Valuable Guidelines To Speed Up Your Website

 If you aim at building a good website, you need to put in some time as well as resources so as to speed up your website. No visitor would bother to browse a slow loading website until and unless he is tremendously interested in its content. Above all, Google has started considering the speed of a website as an important factor in determining its search engine ranking.

 The techniques mentioned below will reduce the server load of your website and thereby increase its speed. You need to be very careful while making the changes as the process is not easy. However, if you happen to be a WordPress expert, you won’t take too long.

 Before you start with the procedure, make sure that you take an entire backup of your website’s theme files and the WordPress database. You need to open http://tools.pingdom.com/ and enter the URL of your website. Then, check the speed of your website, i.e. check how long it takes to load. Speed up your website by using the following techniques.

 1) Getting rid of Unnecessary Database and PHP Queries

WordPress themes are designed in such a manner that they do not often need to be configured by the user. These themes contain a few generic PHP codes. You can easily replace these codes once you install the themes in your blog. You need to remove these PHP queries in order to reduce the server load.

For doing so, you need to open the files “header.php” which are present in your themes folder. For this, you can either go to” Appearance” and then to “Editor” from WordPress dashboard or directly access the file via FTP client and open it in Notepad / Notepad++.

The file “header.php” will contain something as follows:

 <title><?php bloginfo(‘name’); ?> <?php bloginfo(‘description’);?></title>

 <link rel=”stylesheet” type=”text/css” media=”screen” href=”<?php bloginfo(‘stylesheet_url’); ?>“/>

 <link rel=”shorcut icon” type=”image/png” href=”&lt?php bloginfo(‘template_url’); ?>/favicon.jpg” />

 <link rel=”alternate” type=”application/rss+xml” title=”RSS Feed” href=”<?php bloginfo(‘rss_url’); ?>” />

 Text portion which is written in bold in the above code is nothing but the PHP code. All of these five PHP commands get executed every time your website loads in a browser. As there is no need of the themes being portable, you can simply replace the PHP queries with equivalent HTML code. This will make the site to load 20 times faster.

Open your website in any browser and press CTRL+U or go to the menu and choose “View Source”. You will see the code as follows: 

 <title>abc</title>

<link rel=”stylesheet” type=”text/css” media=”screen” href=”http://www.abc.com/wp-content/themes/amalroy/style.css”/>

<link rel=”shortcut icon” href=”http://www.abc.com/wp-content/themes/amalroy/favicon.png” type=”image/png” /> 

<link rel=”alternate” type=”application/rss+xml” title=”RSS Feed” href=”www.abc.com/feed/rss/” />

You will see your domain name in place of “abc” in the above code.  You need to copy the code, replace the same in the file “header.php” and save it. You may also look for similar PHP queries in sidebar.php, footer.php and replace them accordingly. 

2) Eliminating Inactive Plugins

Many times you activate various WordPress plugins out of curiosity and deactivate them if you do not like them. However, the deactivated plugins are still left with the plugin directory. It is wise to remove all the inactive plugins and check if there are any activated plugins which you haven’t been using. Keep you plugin directory clean.

In case you think that you might need any of the deactivate plugins in future, you can just make a list of these plugins in a text document and save it into the plugin directory. 

3) Making use of Free Content Delivery Network (CDN)

Almost all well-known websites use a CDN. A CDN is a group of web servers which are distributed across different locations in order to deliver content to users in a more efficient way. The proximity of the user to the web server certainly has an effect on the response time. Arranging your content across different geographically dispersed servers helps your website pages to load faster.

However, normal users find the CDN service to be too expensive.  CoralCDN takes care of such users who cannot afford the CDN service. It offers a powerful CDN service free of charge. You have to append “.nyud.net” at the end of the hostname of your URL. 

You need to install and activate the plugin. It will automatically rewrite the CSS, images, JavaScripts etc. for you. It allows you to include or exclude any specific files such as CSS or JavaScript pages.

4) Maintaining an Up-To-Date WordPress version

WordPress keeps improving with every new version released. Each update makes WordPress safer and faster as it gets enhanced with new features. 

5) Compressing the CSS Code

The moment you compress your CSS code, the browser will be able to render it faster. You can either compress it manually via CSS Drive service or by using WP CSS plugin. In the manual method, you need to copy the CSS code from the file “style.css” and paste it in the CSS Drive website to get the compressed code which you need to paste back to the style.css file.

 

However, using WP CSS plugin is a better option as it automatically removes all the empty spaces from the CSS code. 

6) Optimizing WordPress Database

WordPress database also undergoes fragmentation just like the hard disk and hence needs to be optimized. You need to go to your hosting provider’s cpanel. Use phpMyAdmin in order to optimize your WordPress database by logging in to phpMyAdmin, selecting all tables and finally repairing and optimizing.

 

7) Compressing & Combining Your Javascript Files

The javascripts are also a reason behind speed loss. You need to trim down the javascripts by using Javascript Compression Services such as JS Compressor and Javascript Compressor.

8) Decreasing Image Sizes

Though images make your posts look lively and attractive, using high-resolution images can increase the server load. You can compress the images without affecting much of its quality by using WP Plugin known as “Smush.it”.

 

9) Disabling Hot linking

Hot linking steals a huge amount of bandwidth. Others might link the images on your website in their write-ups/ articles thereby increasing the server load. You can prevent this hot linking by incorporating a small code within the file “.htaccess”.

#disable hotlinking of images with forbidden or custom image option

RewriteEngine on

RewriteCond %{HTTP_REFERER} !^$

RewriteCond %{HTTP_REFERER} !^http(s)?://(www.)?abc.com [NC]

RewriteCond %{HTTP_REFERER} !^http(s)?://(www.)?google.com [NC]

RewriteCond %{HTTP_REFERER} !^http(s)?://(www.)?feeds2.feedburner.com/abc[NC]

RewriteRule .(jpg|jpeg|png|gif)$ – [NC,F,L]

 

You need to paste the above mentioned code to the file “.htaccess” present within the WP root directory and save it. Remember to replace the feeds and URL in the above code with yours.

10) Download WP Super Cache Plugin

This Plugin caches all the repeatedly visited pages of your website so as to make it accessible to the subsequent visitor instantly. The HTML files generated by Super Cache plugin are served without invoking any PHP code. 

 

In case you are familiar with WP plugins, the plugin called “w3 Total Cache” is a highly recommended one. It is the best if you can properly configure it. It offers better caching and compression options and saves your site’s bandwidth. Moreover, it also supports CDN.

 

11) Incorporating CSS Sprites Technique

By using this technique you can combine all your website images into one single big image with all of them. The moment the browser loads this big image, all the images can be displayed using background-position.

 

In case your website has many static images, this technique would be an ideal one. It reduces http requests and thereby speeds up your website. 

12) Using PHP Speedy to Combine CSS Files and Javascripts

You can increase the speed of your website greatly by reducing the HTTP requests. Using the WP plugin “PHP speedy”, you can combine all CSS files into one file and all javascripts into another. Therefore, now you will have only two files that will be requested.

13) Preloading Your Page Contents

By loading the page contents progressively, you can enhance your page load speed. It is not possible to load pages progressively in some browser if you put the style sheets at the base of the document. The browsers block progressive rendering and the visitor in turn gets a blank page.

You need to include the Style Sheets into the header file.

<title>abc</title>

<link rel=”stylesheet” type=”text/css” media=”screen” href=”http://www.abc.com/wp-content/themes/amalroy/style.css”/>

In the above code “abc” has to be replaced by your domain name. You need to move the link of the CSS file close to the title within the file “header.php”.

14) Adding Expiry Time to Static Content

By adding expiry time to post content such as static images, you can considerably decrease further HTTP requests while loading other pages thereby increasing the speed. 

You need to copy the below mentioned code and paste it into the file “.htaccess”.

 

ExpiresActive On

ExpiresByType image/gif A28800

ExpiresByType image/jpg A28800

ExpiresByType image/png A28800

ExpiresByType image/jpeg A28800

15) Using flush() Function

If a visitor tries to load any of your website pages, it will take 200 to 500 milliseconds before the backend server puts the HTML pages together and displays them. The browser generally remains ideal during this time. By using the PHP function “flush()”, you can load the partly-ready html response onto the browser so that it can fetch the components by the time the backend server finishes with the rest. 

To add this flush() function, you need to open the file “header.php” and look for the tag “</head>”. Then insert the function “<?php flush(); ?>” after the tag “</head>”.

For Example, 

</head>

<?php flush(); ?>

<body>

16) Using DB Cache Plugin

The WP plugin “DB cache” works in a different manner as compared to super cache plugin. It efficiently optimizes your database alone. This plugin caches MySQL queries of WordPress into a file. As a result, less space is used for caching which thereby enhances the performance of your website.

Using the above techniques properly will certainly speed up your website to a great extent. You can go back to http://tools.pingdom.com and check the speed again. You will definitely notice a considerable improvement.

 

However, apart from all the factors mentioned above, your website’s speed also depends upon various other factors. The hosting, number of CSS files and Javascripts you use etc. are also very important. You can enhance the speed by choosing VPS hosting to the usual shared hosting.

NO COMMENTS

LEAVE A REPLY