Reduce Page Load Speed, Increase Performance

Receive compressed pages in response from server for faster loading of the WordPress website.
<?php	
	/* keep this code in main index.php wordpress root, for php based include on top of header */

	if(substr_count($_SERVER["HTTP_ACCEPT_ENCODING"], "gzip")){
		ob_start("ob_gzhandler");
	}else{ ob_start(); }
?>

Add code in .htaccess file
# compress text, html, javascript, css, xml:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
# Or, compress certain file types by extension:
<files *.html>
	SetOutputFilter DEFLATE
</files>

you can test compression at: http://www.gidnetwork.com/tools/gzip-test.php
find this tutorial at : http://www.apphp.com/tutorials/index.php?page=gzip-and-deflate-compression-in-web-development
Note: Some hosting servers like godaddy provide this compression service with hosting, no need to add the code manually. You can check in cpanel or can get support from your hosting service provider.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s