Host Images of WordPress Blog on Subdomain
We all are know that Page Speed of the Web Page is Important factor for the Search Engine Ranking. The Web Page who have a better Page Loading Time that will Rank better for sure in a Search Engine. “The Web Must be a Faster” – Google Inc. Here I will going to show you How to Host Images of WordPress Blog on Subdomain for Better Speed of the WordPress Website/Blog.
Actually In WordPress Site/Blog the Images are Host in a Same Domain, This is Slow down your Page Speed of your WordPress Blog/Site. Instead of Hosting Images On a Same Domain, We can Host Images on Subdomain and that will surely Improve the Performance of WordPress Website or Blog.
Host Images of WordPress Blog on Subdomain:
You May Heard the thing WordPress not allow the Host WordPress Images On Subdomain, But It allows. This Article is about How to Host Images of WordPress Blog on Subdomain for Better Web Page Speed.
First of All
1.) Create a Subdomain for your site
Login to your CPanel and Click on Subdomains
Then One Page will appear, Enter your Subdomain name. Here I have insert Images. Document Root means Directory after creating Subdomain the Directory/Folder will automatically created. you can also modify the Directory Path.
Note: This Facility is Provided by the Hosting Providers, If you are unable to Create a Subdomain then you have to contact your Hosting Providers.
See Also: How to Install WordPress on HostGator
2.) Change Default Image Uploading Folder in WordPress
After the release of WordPress 3.5, the option for custom uploading path has been removed from the ‘Media settings’. So for getting them back you have to download this plugin click here. This Plugin Help you to Set a New path of Uploading Media in WordPress Blog/Site(You can Remove this Plugin After Completion of the Hosting Image in Subdomain Process).
What You have to do go to the Settings of the Plugin WP Original Media Path and Give Name of Folder and Subdomain path where you host now Images for WordPress Blog. So Your New Images Store on a Subdomain means New Location.
3.) Update the old post images location:
After Doing this Things Now it’s Time to Move Old Uploading Images on a New Location means on a Subdomain. Changing the Location of all old files on New Location is very stupid Job, So what you have to do So, First download all the folders containing the images under /public_html/wp-content/uploads/ from your server and upload all those folders in the folder /public_html/images/. To update the new location of your images, for that you have to execute a simple SQL query on your database. You can do this from the phpMyAdmin in your hosting control panel.
Now Click on the phpMyAdmin > select your database from the left side > click on the “SQL” tab.
Now You put the following query in the box.
UPDATE wp_posts SET post_content = REPLACE(post_content,'http://www.yourdomain.com/wp-content/uploads/','http://images.yourdomain.com/')
Click on “GO”. Then This query will replace “http://www.yourdomain.com/wp-content/uploads/” with “http://images.yourdomain.com/” in all the image location URL. For update the images links in the media library run the following sql command:
UPDATE wp_posts SET guid = REPLACE(guid,'http://www.yourdomain.com/wp-content/uploads/','http://images.yourdomain.com/')
4.) Redirect the old images link to to Subdomain
Now You have completed all the Jobs with your site and database. But Still Google has crawled and indexed your old images. So redirect the old image urls to the new image URLs. to let Google know that those images are same. To do so add the following 1 line in your .htaccess file.
RedirectMatch 301 ^/wp-content/uploads/(.*)$ http://images.yourdomain.com/$1
Note: Backup your .htaccess file before any changes. That’s all to set your Subdomain as post-images upload location.
See Also: Best Free SEO Plugins For WordPress
Now That’s It. Now You Host Images of WordPress Blog on Subdomain for Better Speed of WordPress Website/Blog. This Tweak Speed up your WordPress Website and Increase your Blog Performance.
If you face any Problem with this Tweak you are most welcome to ask us, Just Comment below.
1 Comment
Good Info, Thank you Harshil 🙂