Take the 2-minute tour ×

When you create a site (small, static content) how far do you go with folder detail? Do you have a /images folder in the site root, or /content/images or /images/site, /images/public?

I'm one of these people who likes things to be "just so" in regards to folders, but what's the best way to do it?

share|improve this question

3 Answers 3

up vote 7 down vote accepted

Personaly, for static content, I prefere host it in an other FQDN like that:

  • static.mydomain.invalid/img
  • static.mydomain.invalid/js/{my-scripts}
    • static.mydomain.invalid/js/libs/{my-libs-eg-mootools}
  • static.mydomain.invalid/css
    • static.mydomain.invalid/css/img
  • static.mydomain.invalid/[...]

it's simpler, you don't send cookies's informations to your statics content and do some bandwidth savings.

For dynamic contents, I use rewriting to have a structure like that:

  • www.mydomain.invalid/my-content.html
  • www.mydomain.invalid/my-content/my-sub-content.html

And I try to avoid more than 2 or 3 level of sub directory.

share|improve this answer
I've decided to mark this as my answer as I have started a seprate domain for content. Thanks for the advice. –  tombull89 Nov 6 '10 at 19:30
Glad to read it ^^. Take care that your static content's domain is cookie free: developer.yahoo.com/performance/rules.html#cookie_free. Good luck! –  Pascal Qyy Nov 6 '10 at 20:59

Organize in such a way that maintaining it is easiest. Have as many subdirectories as necessary to keep it organized and meaningful. For small sites I only have a single directory for images. For larger sites I'll have subdirectories for specialized images (icons, buttons, photos, temporary, etc). That makes it much easier for me, and anyone else who has to maintain the site, to figure out what the heck is going on when we revisit the site months or years later. And with images, and similar files, your users never see the URLs of those files so they can be longer and won't inconvenience them one bit.

The only issues you may have with many subdirectories is when it comes to web pages. If you have too many subdirectories it will result in longer URLs which can be inconvenient for users at times. Then again, sometimes this will be a natural byproduct of a site's content. In these cases plan ahead and try your best to find a balance between maintainability and usability.

share|improve this answer

I think there isn't a standard in the word inception.

Any folder hierarchy that makes sense is valid. I used to have the following (considering just static content):

/ {root folder, pages goes here}
/styles/ {stylesheets goes here}
/styles/img/ {images used in stylesheets goes here}
/styles/fonts/ {fonts used in stylesheets goes here}
/scripts/ {javascript files}
/img/ {content images}

Maybe having some folders for categories organization.

That's it. The point I think we should take care is about directories deepness. More than 4 degrees isn't that good for SEO, and probably an information architecture is needed when reach this point.

share|improve this answer

Your Answer


