A lot of developers place all image files inside a central directory, for example:


Isn't it better (e.g. content architecture, on-page SEO, code maintainability, filename maintainability, etc.) to place them inside the relevant directories in which they are used?

For example:


What is the best practice here regarding all possible considerations (for static non-CMS websites)?

N.B. The names product1-large and product1-thumb are just examples in this context to illustrate what kind of images they are. It is advised to use descriptive filenames for SEO benefit.

  • Frameworks such as Zend often have features which if you store images in a single folder say /public/images or img I forget it's easier to use through out the code. If you can imagine writing a programming having to remember which folder your image is in category1 or category2 it would be a headache. What about products which belong in two categories. Then what do you do? It's just a matter of working efficiently.
    – Anagio
    Dec 17, 2012 at 5:29

3 Answers 3


I personally use a bit of both... I place all the images with a general purposes (things like : design, icons, site content, sprites, etc..) in a single directory.

Then for everything related to a single "thing" on my website, by example a .jpg avatar related to a single user, I put that in a specific directory but inside of a centralized structure.. something like this :


At first there is the data directory, it's a good idea to have a main directory like that because when comes the time where you want to do urlRewriting like that : http://mywebsite.com/users/1/, that will confuse everything as the directory already exists on the server root... so putting everything in a centralized directory prevents that.

Also note that I don't use product's name or category's name in the sub-directories, I prefer to use IDs as it's more optimized and simple to use.

I can't prove this is the best structures considering SEO, but it's the best structure that I've experienced and I can say it's the most extensible because everything is placed in a logical way in a point of view of object oriented programming. If you want to add a personalized profile song for every site's users, fine ! You already have the structure right there, no need to add a new directory called songs/ and etc...

And based on that structure, nothing prevents you from using some kind of urlRewriting to have URLs with the products/categories name in it, and then point to the IDs based structure on your server, that would be perfect I guess, but I've never tried...

Hope it helps :)


The location of images has no effect on your rankings, it will use the URL of the page and not that of the server, otherwise those with Content Delivery Networks wouldn't use content delivery networks.

The file name however does help a little. So rather than having product1-large.jpg

You should use something like this:

<img src="http://www.example.com/images/ipod-nano-pink.jpg" alt="Ipod Nano in Pink">

Personally unless you have 10,000's of pictures theres no reason why you can't slam them all in one folder. If you do have this many then I'd use something sort as possible so the HTML code is short.

For example

<img src="http://www.example.com/i/apple/ipod-nano-pink-lg.jpg" alt="ipod nano in pink">
<img src="http://www.example.com/i/apple/ipod-nano-pink-sm.jpg" alt="ipod nano in pink">
<img src="http://www.example.com/i/microsoft/xbox360-lg.jpg" alt="xbox 360">
<img src="http://www.example.com/i/microsoft/xbox360-sm.jpg" alt="xbox 360">

Just because your site is static doesn't mean that the pictures need to be in the same path.

Just use the full path as shown in my examples or if you want to use shortcode if you have:


you would use


Personally I find it easier just to use the absolute paths.

  • 1
    I wouldn't say it has "no effect" unless I had data, but I understand where you are coming from. I'd like to avoid an SEO debate, but you may find this answer interesting. The product1-large.jpg was just an example for the sake of keeping the example short, but good that you picked up on it!
    – Baumr
    Dec 17, 2012 at 0:49
  • It has no effect due to the climb in CDN networks, and people using CMS systems that do not store images in the same path as that of the URL path. Anyone trying to debate this would be thinking non logical. ;) It could help Google imaging rankings I guess on credibility, but I seriously doubt that. Dec 17, 2012 at 0:51
  • Furthermore in this topic and not swinging in the SEO route. Google uses the page content, and ALT tag to verify the credibility of the image, while the location of the file could be a factor it, there are so many other factors that I doubt its even required. Dec 17, 2012 at 0:55

If you are looking at images for SEO benefit, then forget about where to put them in your directory structure. Better look at creating an image sitemap and submit it to Google Webmaster for indexing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.