How to speed up wordpress blog or site

Many wordpress blogger always spending some time for speeding up there blogs. In this aritcle I will tell you how you can speed up your wordpress blog with easy steps. Loading your website is very important. If your blog or site not more fast then bounce rate of your website will be high.

 speed up wordpress blog

There is apache module called zlib. which is used for compression.

zlib is a lossless data-compression library that will help you to serve your pages faster. This will compress the static data of your website. like images, css and media and javascript files. It compresses the PHP that WordPress sends to your visitor’s browser so that it displays much more quickly. Compressing and sending is much faster than sending the PHP in its full size format.

 speed up wordpress blog
speed up wordpress blog

If you are using dedicated hosting service then easy to make changes in your files but if you are using the shared hosting then first you need to check zlib compression is available or not.

For checking zlib library create the phpinfo() file and see the zlib is there or not.

Mostly 99% shared hosting gives zlib compression facility. Just open your header.php file from your wordpres theme folder and following code in that file in top of file section.

ini_set(’zlib.output_compression’, ‘On’);
ini_set(’zlib.output_compression_level’, ‘1′);

This change will save your bandwidth and webpage will load faster. you can see the result after doing this change. In my site I saw the difference.

Website will load 3 to 4 times faster than earlier.

 speed up wordpress blog
speed up wordpress blog

how to serve wordpress images from subdomain

creating sub domain for wordpress images is best way to increase your wordpress site speed. We given steps to, how to serve wordpress images from sub domain. Many shared hosting and wordpress bloggers and  websites are using the apache web server for hosting the wordpress sites. Apache Web server is having his own rules and behavior. By default when you open webpage of your website. That time you are making so many requests to apache web server with same domain name. That will create queue to apache web server with same domain name.

how to serve wordpress images from subdomain

For reducing the load time you should keep image file on different sub domain. Means though image subdomain you can send a parallel request to Apache web server. It will reduce the concurrent connections to web server. WordPress provides the functionality to set different domain or sub domain for images.

In this article I will show you how easily you can set the wordpress images from sub domain. First create subdomain through your control panel. Use following step for creating subdomain.

how to serve wordpress images from subdomain
how to serve wordpress images from subdomain

I recommend to create the images subdomain because images subdomain is good for SEO. Here I created the subdomain for my images. Then set your wordpress images path in document root setting. Normally your wordpress images are stored in wp-content/uploads directory. You can use following setting for setting the document root.

how to serve wordpress images from subdomain
how to serve wordpress images from subdomain

After creating subdomain for images and setting up the correct document root for images subdomain. Go to your wordpress admin panel. From right side panel you should go to settings -> Media panel. This page will look like as follows:

how to serve wordpress images from subdomain
how to serve wordpress images from subdomain

In “Full URL path to files” textbox put your image subdomain name and click on save changes button. Uncheck the organize my uploads into month- and year-based folder option because which is not good for SEO purpose.

After this your images will come from image subdomain but old uploaded image files will still come from older location and same domain. For changing the older images file location and domain information you should use the following steps.

Go to your Mysql databases and select the your wordpress database. You can use the phpmyadmin sql manager for this or you can use command prompt for this if you are having dedicated hosting server. If you taken shared hosting then I recommend to use PhpMyAdmin.

Use following two SQL query: (Note: You should use your images subdomain and your domain name in SQL query)

UPDATE wp_posts SET post_content = REPLACE(post_content,'','');

UPDATE wp_posts SET guid = REPLACE(guid,'','');

After this your old images files will point to images subdomain. If your images and wordpress website is old then google and other search engines already indexed your images. So We need to write the redirection rewrite rule for images in your .htaccess file. This file you will find in your Root directory of wordpress installation.

Use following line of code in your .htaccess file.

RewriteEngine On
RewriteBase /

RedirectMatch 301 ^/wp-content/uploads/(.*)$$1

Above all steps are important to change the wordpress images into images subdoamin. If you are having any issues or questions about this article. Then please write to me.

How to add pagination in wordpress

Many times adding the custom pagination in wordpress blog is very important. Adding custom pagination in wordpress blog is good. In this article, we will show you, How to add pagination in wordpress with plugin and without wp plugin

How to add pagination in wordpress

  • Simple WordPress Default pagination

You need to open the your index.php file from wordpress theme and put following code in that file.

<div class="navigation">
<div class="alignleft"><?php next_posts_link('Previous') ?></div>
<div class="alignright"><?php previous_posts_link('Next') ?></div>

If you want the pagination in single post then you can use the following code:

<?php next_posts_link($label , $max_pages); ?>
<?php prev_posts_link($label , $max_pages); ?>

More pagination style visit above URL: wordpress pagination style without wordpress plugin

There are some very nice wordpress plugin available for wordpress pagination.

How to add pagination in wordpress
How to add pagination in wordpress

PageNavi wordpress plugin is really nice. I personally like this plugin so much. With this plugin you can apply your custom css also.

  • Changing the CSS

If you need to configure the CSS style of WP-PageNavi, you can copy the pagenavi-css.css file from the plugin directory to your theme’s directory and make your modifications there. This way, you won’t lose your changes when you update the plugin.

Alternatively, you can uncheck the “Use pagenavi.css?” option from the settings page and add the styles to your theme’s style.css file directly.