Add Our Facebook App »

WordPress tip-Store Blog post Images in a different Folder or Subdomain

Written by Amit Banerjee under Blogging

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.

Configure default image upload folder in wordpress

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”.

Configure WLW Ftp Settings

4.Select your image Folder that you Created and hit Ok.As simple as that.

  1. Reader Comments

  2. 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.

    August 18th, 2009
    • @harsh : Glad you found it useful. Yes if possible images should be stored in a separate subdomain for faster loading

      August 18th, 2009
  3. 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.

    September 27th, 2009
    • @ mwaterous : I am sorry but i am unable to understand your question.Could you please clarify a bit ? Thanks

      September 27th, 2009
  4. 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.

    September 27th, 2009
    • @ 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 !

      September 27th, 2009
  5. 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?

    October 5th, 2009
    • @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

      October 5th, 2009
  6. hi amit, tq for this tip. i already apply for my blog. but when i try to upload img when writing new post, an error comes out:

    ” Unable to create directory /public_html/img/2009/10. Is its parent directory writable by the server? ”

    i already set the file permission on img folder to 777 and all their sub-directories. also try to create folder name 2009 and 10. but the problem is same.

    how can i fix this?

    and does this tip will improve my blog loading speed? because my blog full of picture and time by time, the loading speed is decrease. any ideas how to speed up? i already use wordpress super-cache. but it was same.

    tq for your future answer. :)
    have a nice day from malaysian blogger..

    October 6th, 2009
    • 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

      October 6th, 2009
  7. wow, great tips… thanks for share…

    November 16th, 2009
  8. 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

    January 3rd, 2010
    • @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

      January 10th, 2010
  9. This is quite useful and should be used on slow servers. Increases the blog’s speed.

    March 21st, 2010
    • @NPXP: Yes, I have always hosted images on a subdomain because of speed and easier management. Thanks for the comment

      March 21st, 2010
  10. Hello,
    Is it possible that image upload folder to be located at another ftp server??

    April 6th, 2010
    • @Kote: Yes, its possible to define a separate FTP server for the image upload folder.

      April 7th, 2010
  11. @Amit
    Please tell me how ?

    April 7th, 2010
  12. 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.

    April 14th, 2010
    • @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.

      April 14th, 2010
  13. @Amit
    Hey, can’t you help me to define a separate ftp server for image folder?

    April 15th, 2010
  14. @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.

    April 15th, 2010
  15. @Amit
    Thank you, I’m waiting :)

    April 15th, 2010
  16. @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.

    April 15th, 2010
  17. @Amit
    Okey :(
    thanks

    April 15th, 2010
  18. @Amit – Done! Its working now without any permission problems.

    April 15th, 2010
    • @Sagar: Glad it helped. Thanks for the comment.

      April 15th, 2010
  19. 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 ?

    May 12th, 2010
    • @waqas: Yes, it will work as long as you have control over the hosting space where the images are stored

      May 13th, 2010
  20. Sagar

    Hi
    I’ve hosted the images of my site in the subdomain. But google is not crawling those images. Please Help me ..

    June 17th, 2010
    • @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.

      June 17th, 2010
  21. Sagar

    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.

    June 17th, 2010
  22. Sagar

    About 5 months. But I recently transferred the images in the subdomain.

    June 17th, 2010
    • @Sagar: Give Google Bot some more time to find the new location of your images.

      June 18th, 2010
  23. Great idea but when I go to Settings there is no Miscellaneous… I’m self hosting WP

    July 5th, 2010
    • @Mark: Is your a/c an administrator account ?

      July 6th, 2010

Add Your Comment

All Comments are Moderated.

YOUR COMMENT



About This Site

Ampercent is a technology blog on computer tutorials, software guides, how to tricks and web tools. The blog is updated daily and written by two computer science students from India. Read More »



Subscribe to RSS Feed

Join Our Community

Submit Product For Review

Want a Software or a product to be reviewed ? Tell us about it, we will do the rest.