If you are my regular reader you might have noticed similar page speed related posts I’m writing since few weeks. I was trying to increase my blog’s performance. I made a mistake while buying hosting package because I was unaware that, shared hosting is main reason for your blog’s performance. I tried almost every possible methods like; Installing WordPress Total cache Plugin (W3TC), Using CloudFlare CDN, Hosted my JQuery files in code.Google.com and Installed Use Google Libraries plug-in, Hosting images on external websites etc.
Well, now my blog’s performance is slightly increased after long chat with my hosting company and they increased my php memory.
In today’s post I’m going to write a tutorial (in fact old) which will reduce your page load time. This tutorial is about hosting all your images in your blog’s sub domain. As you already know, Browsers creases simultaneous connections to web servers to reduce page load time. Hosting your blog images on external website like imgur.com or flickr.com also increases your page load speed. But hosting images on your own web server is better than hosting on other free services.
Ok let’s start.
Creating a Sub Domain
First of all you have to create a sub domain to your present WordPress blog. If you are using cPanel or other control panel to administrate your blog, it’s simple and easiest way to create a sub domain.
In my case I’m using iPage as my host and I will show you how to create a sub domain using iPage beta control panel. If you use cPanel refer this article. (http://www.everymanhosting.com/cpanel-tutorials/create-subdomains.php)
Go to this link (http://www.ipage.com/controlpanel/beta/) and click on Domain central under Domain Tab.
Click on + mark to expand the options. Click Subdomains and name your Subdomain. I recommend http://image.yourdomain.com because it’s easy to remember as you are going to host all your images on that Subdomain.
Now you have to point the newly created Subdirectory to WordPress’s default upload directory ( /public_html/wp-content/uploads or just /wp-content/uploads ). You can do this by adding link under Points to subdirectory in iPage or Document Root in cPanel.
In my case I have created http://images.techinfoblog.net and “images” is my subdirectory.
Once you created a new Subdirectory which redirects to WordPress default upload directory, then you must update WordPress Media Settings.
To do this, login to your WordPress Control panel and click on Media under Settings.
Now, from the Media Settings page, look for uploading files. Don’t change anything in Store uploads in this folder keep the default and the second text box must be empty. Type your newly created Subdomain name as shown in bellow image and click on Save.
From now onwards all your uploaded images uploads into your newly created subdirectory. But the default directly structure of WordPress will be remains.
Updating MySQL Database
Ok the first part is done. In next steps we are going to run some SQL scripts. Please, if you don’t know how to run SQL queries, never try yourself; you may completely crash your site. So ask your friend or Hosting companies help.
In this step we will update MySQL database, this step is important because, WordPress still has hundreds of thousands of images you have uploaded before will be in the default upload directory. You have to instruct mySQL to replace them in to newly created sub domain so that all the images in your blog will keep the image link structure as it is. For example one of my old images is and you want it to send to new directory that is; , this can be done using below SQL script.
Note: Make sure you have latest database backup is in place before try this step. You can always restore and get back to normal if you did any mistake. Also, I (Navin) or my blog ) is not responsible. Read our disclaimer on the footer of this page.
Using the phpMyAdmin run the below script, which will Update MySQL tables for all previously uploaded images.
UPDATE `wp_posts` SET `post_content` = REPLACE (`post_content`, "http://techinfoblog.net/wp-content/uploads/", "http://images.techinfoblog.net/" )
And
UPDATE `wp_posts` SET `guid` = REPLACE( `guid`, " ", " http://images.techinfoblog.net/")
Make sure to change to your domain name
Ok, done. You have successfully added new Subdomain image hosing to your WordPress blog. It might take few minutes to update all your images. Close everything; clear your browser cache, purge cache if you are using W3TC or other cache Plugins.
Verify if everything working. If all are working and your blog images are linking to your newly created Subdomain proceed to next final step.
Updating .htaccess file
Firstly backup your .htaccess file. Then, update anywhere with below line.
RedirectMatch 301 ^/wp-content/uploads/(.*)$
This is because; we must redirect all the previously uploaded images to new directory. Otherwise you will have duplicate images, which make Google worry.
That’s it, you have successfully created a new Subdomain which servers as your own free CDN (Content Delivery Network) to host your images and makes your blog loading faster. Always make sure to backup files / databases you do any changes to them. This is make your work fail proof.




















Pretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Anyway I’ll be subscribing to your feed and I hope you post again soon.
Thanks Kimberly Bauknecht .
I was suggested this web site by my cousin. I’m not sure whether this post is written by him as nobody else know such detailed about my problem. You’re wonderful! Thanks! che | cpanel hosting |
This is an awesome article i found throughout yahoo and google. I recognize the value of to you we wish to learn more concerning this topic area inside a second new blogging in case you have time to tell us in which. There’s no doubt that you will make this crystal clear far more as part of your upcoming article and i’m genuinely looking forward to it. Honestly awaiting it all. Thanks a lot.

Hi, this is a great posting there’s no doubt that. i truly appreciate to you and i are interested in learning more aobut this post. Thanks.