WordPress tip-Store Blog post Images in a different Folder or Subdomain
If you are using a self hosted WordPress platform it is recommended to Store your Blog post images in a different directory.This will ensure faster loading of your Blog pages.This tutorial explains how to achieve this.
Why should i need to Upload my Images in a Different Folder or Subdomain ?
1.Most browsers (Firefox,Chrome) create only a limited number of connections to one site at a time.So hosting your Blog post images will speed up your blog loading time.
2.Storing images in a different domain keeps the blog posts images organized.
To achieve this in WordPress 2.6+
1.Go to your Hosting panel and create a Subdomain for storing your blog post images.For example : img.yoursite.com
2.Open your WordPress dashboard and Click on Settings.Then click “Miscellaneous”.
3.Now change the default image upload folder which is wp-content/uploads.
![]()
Do not select the Checkbox “organize my uploads into month and year-based folders.
Configuring Windows Live Writer : If you post from Windows live writer you will have to configure the ftp settings.
1.Open WLW and go to Tools –> Accounts
2.Select your Blog and Click Edit.Then Select pictures
3.Now Select “Upload pictures in an FTP server” and click “Configure FTP settings”.
![]()
4.Select your image Folder that you Created and hit Ok.As simple as that.




Hey must say it’s a great tip. Hosting images in sub domain will reduce the concurrent connection and thus will make your wordpress blog fast. Kudos to this useful post.
@harsh : Glad you found it useful. Yes if possible images should be stored in a separate subdomain for faster loading
How does WordPress know what credentials to use when accessing this subdomain? There’s no where to enter ftp information in regards to uploading your files to another location such as this.
That would be very useful information. :) Just entering the url doesn’t seem like the end of the instructions.
@ mwaterous : I am sorry but i am unable to understand your question.Could you please clarify a bit ? Thanks
Don’t mind me, it’s late and I wasn’t thinking clearly. It dawned on me that this is for uploading them to a subdomain and not a completely different domain, and thus the path was an absolute and not off of a remote ftp.
@ mwaterous: Yes you are right now. this tutorial explains how you can store the images and other media on a folder in your domain only. Not on a different domain as you asked.Thanks for your interest here !
Hi Amit,
I need clarification about two points,
1.Can we do the same after we publishing some posts.Else should we do the same during the set up of the blog itself?
2.Second while configuring in WLW do you get any message after modifing the image storing location?
@George : First of all thanks for stopping by.Here are the answers :
1.You can modify the path for storing images at any time.By default the images are stored under wp-content/uploads. So if after some months you decide to change the upload location to suppose img[dot]yourdomain[dot]com it wont lead into problems.As after you make the change all your images will be stored there.However the previous posts will pull the images from wp-content/uploads only.In short,this process can be done at any time and not mandatory during setup.
2.No.Windows live writer can auto detect the image upload folder if you have the necessary permissions given.You can set the image folder in WLW from Blogs–>Edit blog settings.
hope that helps
Yes this tip will increase the loading speed as a browser can process requests from different domains at the same time.That means if you Call the images,CC and Js files and media from a separate domain then the caching will be much faster as the browser can download the required files from different domains parallely.Call everything from a single domain and everything is queued after a certain number of requests.
Regarding the WLW config : Baloot,everything seems to be normal.I have used WLW –>Edit blog settings–>configure FTP to set the image upload folder.But before doing that do the same in your WP-dashboard or there might be a conflict.
Hope that helps
wow, great tips… thanks for share…
Hello Amit, I tried doing what you said but I got this error:
Unable to create directory /public_html/img. Is its parent directory writable by the server? What do I need to change?
I am not sure what windows live writer is – I download the pictures to a folder on my computer and then upload it to wordpress.
Your help is much appreciated. Thanks
malini
@Malini: Open your FTP account using FTP software (e.g Fielezilla). Right click on the image directory and set the permission level to 777. That would make the directory writable and you can store the mages of your posts in your chosen directry
This is quite useful and should be used on slow servers. Increases the blog’s speed.
@NPXP: Yes, I have always hosted images on a subdomain because of speed and easier management. Thanks for the comment
Hello,
Is it possible that image upload folder to be located at another ftp server??
@Kote: Yes, its possible to define a separate FTP server for the image upload folder.
@Amit
Please tell me how ?
Hey Amit, I am getting the error “Unable to create directory /public_html/media. Is its parent directory writable by the server?”
In this case what do i have to do? I have used the folder “/public_html/media” for storing uploads and given the full url as “http://media.aspiredtechie.com”. Still it does not work.
@Sagar: Here is what you need to do:
1. Open your FTP server from Filezilla or other FTP software
2. Right click the media directory where you want to store the uploads and set the permissions to “777″. (Read write and execute permisssions).
3. You are done. Go back to wordpress and change that image upload folder.
Thanks for the comment and do let us know whether the problem was solved or not.
@Amit
Hey, can’t you help me to define a separate ftp server for image folder?
@Kote: Sorry for not replying. I am testing the options to define a separate FTP server for the image upload folder. I will post the answer in a day or two. Thanks for your patience.
@Amit
Thank you, I’m waiting :)
@Kote: It looks like you can not change the root domain and host images on a separate domain.
Suppose your site is hosted at xyz.com. You can not host the images at abc.com but can surely use a subdomain on xyz.com to host the images. This is because WordPress can not identify any other domain to store the media files which is different from the domain where you installed WordPress.
@Amit
Okey :(
thanks
@Amit – Done! Its working now without any permission problems.
@Sagar: Glad it helped. Thanks for the comment.
Hi
I have a strange situation and searching net lead me to your blog.
My hosting space for my photography site is exhausting and at the moment i am not a position to pay more to increase web space.
And its obvious , i cannot upload images to separate domain.
But i can upload images seperately from FTP on other server
and insert the links in my posts …
Noone sees the picture path , so it will work somehow ..
what you say ?
@waqas: Yes, it will work as long as you have control over the hosting space where the images are stored
Hi
I’ve hosted the images of my site in the subdomain. But google is not crawling those images. Please Help me ..
@Sagar: Check your robots.txt file to see whether your subdomain is blocked or not. You can use the site operator in Google Images to check whether your site’s images are indexed or not. Thanks for the comment.
when checking crawler access of img.mydomain.com in webmaster tools, it shows the message “Not in domain”. I’ve also used site operator to see whether the images are indexing. But no images are showing there. Also the images are not appearing in the cached pages by Google. Please describe in details. Thank you for your quick response.
@Sagar: How old is your site ?
About 5 months. But I recently transferred the images in the subdomain.
@Sagar: Give Google Bot some more time to find the new location of your images.
Great idea but when I go to Settings there is no Miscellaneous… I’m self hosting WP
@Mark: Is your a/c an administrator account ?
First thanks for the information. Was trying before and was failing. Now I solved it and i want to give my two cents to the group.
Problem: different subdomains (sub1 … n) but sometimes the same pictures.
Several blogs in subdomains: http://sub1.domain.com
Pictures for all blogs in : http://www.domain.com/pic
1.Adminfield: ../pic
2.Adminfield: http://www.domain.com/pic
Works like a charm.
But I go with the datestucture of the folder, because i think that the access for a big amount of pictures is faster by using subfolders.
Cheers
Norberto
Thanks a lot, saved my day.
yeah ! that’s the thing i have been searched for a long time ! thanks
i m running celebs blog, with lot of pictures in one post. i read somewhere that browsers can use only 8 threads at a time to download data from a single domain. so am much slow.
i need to ask one thing that is there any possibility to set multi subdomains as cdn(upload folders) on self hosted… for example
image1 on sub1.domain.com
image2 on sub1.domain.com
image3 on sub2.domain.com
image4 on sub3.domain.com
can we do this on our self hosted blogs by hand or automated ways or with plugins?
thanks for sharing !
Do we need any SQL query ?
@giao: You do not need an SQL query, just specify the location of the folder in Image folder settings.
great ! it’s working like a charm ! thanks
Thanks alot this really came in handy and page was seo friendly – i really didint have to search to hard.
Three questions:
1. In the original WP setup, everything in “Uploads” disappeared. Any idea why? I can find the pictures nowhere.
2. Are pictures actually stored in the “Uploads” directory or are they stored in the database?
3. Why do you recommend NOT selecting “organize by year/month”?
Thanks, Keith
@Keith:
1. If you can’t find any image in the uploads folder, then maybe you have accidentally deleted them from your web server. Changing the settings from WordPress dashboard does not deletes the images, it only changes the location of the folder where WordPress stores the images.
2. Pictures are not stored in the database, they are stored in your web server. The database contains the URL’s and the necessary refrence for the actual files that is in your web server
3. I recommend not using Year / month terminology because they create folders and subfolders which increases the length of the URL of the image – not good for SEO.
Thanks for the questions, really enjoyed answering them
Thanks, Amit. I understand the answers.
I’m relatively new to WP so am learning all the time.
I believe this is a WP site. Which theme? (I couldn’t find it from “view source.”)
Again, thanks for helping and Happy New Year!
Keith
@keith: Yes, this site runs on WordPress and the theme is custom made. And wishing you a very happy new year too :)
i really didint have to search to hard.i’m relatively new to WP so am learning all the time.
Hi Thanks for the tutorial.
I’m building my site using Bitnami.Still I didn’t host it yet. So where I should create img folder ?
Thanks.