Solved WordPress Bandwidth Usage issue


Few days before, one of my friend contacted me and said his blog is down and showing like

Bandwidth Limit Exceeded

The server is temporarily unable to service your request due to the site owner reaching his/her bandwidth limit. Please try again later.

He gave me the access to cPanel and wordpress admin login details.

I have done the following things in his blog

1). Deleted unwanted themes and plugins

2). Added following code in functions.php for remove the WordPress Version number.

function remove_version() {
return '';
}

add_filter('the_generator', 'remove_version');

3). Deleted readme.html and xmlrpc.php

4). Disabled Post Revisions in WordPress

Open wp-config.php located in wordPress root directory and add the following code:

define('AUTOSAVE_INTERVAL', 300 ); // seconds
define('WP_POST_REVISIONS', false );

5). Disabled hotlinking of images.

Open .htaccess and add the below code

#disable hotlinking of images with forbidden or custom image option
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?domainname.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?google.com [NC]
RewriteRule \.(jpg|jpeg|png|gif)$ – [NC,F,L]

5). Added the below code in header.php file to find out the number of queries website has got,

<?php echo $wpdb->num_queries; ?> <?php _e(‘queries’); ?>. <?php timer_stop(1); ?> <?php _e(‘sec.’); ?> 

This code will display the number of queries the page is producing and the time to process them.

Related Posts Plugin for WordPress, Blogger...