If you are anything like me, you may have started out with a remotely hosted website or application, usually a bulletin board or blog when you first dove into the world of a website administration. However as you learned more and hungered for a greater exposure, control and ideas started bubbling out of your head, your needs would have increased and renting your own shared hosting space became the next viable option.
Sure at first you may have been hosting the same forum software you had before, but now you could add onto that software, create a website around it and really start experimenting.
Therein is where the problem for many starts, and those of our ilk tend to be meticulous in certain ways, but often that meticulous nature does not extend to the organisation of our physical and virtual work spaces. For instance I work from a home office in my nine to fiver, whilst my desk and work area is “clean” to my understanding of the word, it does not come up to scratch against the standards of my not so tech savvy partner, scraps and piles of paper, which to me are somehow useful are to my partner, candidates for the shredder, let’s face it, it’s organised chaos.
When we translate this to our shared hosting spaces, particularly those who have multiple domains under the one hosting account, in a metaphorical way, your webhosting account ends up like your desk, you know basically where things are, you just have to find the right pile to look in to find what you want, easy right?
Well sure, it is easy for you to find what you want, but then what happens when your site grows to the point you require other developers or Administrators assistance to keep the site going?
What happens when you want to try to sell the site?
What happens, when a year down the track, you need to find that code snippet you wrote, deep in one of you many domains and folders?
Well it means the long haul of looking through likely directories until you find it, for the sake of sanity, your own, and others, it pays to plan out your wbstructure beforehand, or to at least spring clean every few months and ensure that everything is organised and files away in a manner that makes sense to you, and will make sense to anyone else who needs to access the structure of your site.
Getting into good habits early or learning them as soon as possible will go a long way to ensuring your online success, and to those with aspirations for greater things, and looking to find web development and management work, having a sample of a clean and organised environment and knowing how to keep one, is vital to gaining a position in the industry.
Myself, I have been working with websites since around the year 2000/2001, from simple one page, junk sites, through to full scale busy forums, personal blogs and commercial sites and web applications at first on a remotely hosted application, things were fine, i had no access to the file structure and things were great, then I purchased my own space, with the view to releasing some web applications I had written, again things were going ok, there wasn’t much more than one site on there, then I moved into a new host, purchased a secondary domain and started another site on the same space, and over time began to add more and more domains, until it sits, where it is now at over 10 sites running off of 8 domains, as well as various test directories, sub-directories for testing and an entire mess, until i decided to clean things up and start using standards that I had decided on after giving the topic several days thoughts.
So how do I organise things and how should you?
Typically a hosting account will consist of the following
- WebRoot
- public_html
- Site Files
- public_html
However recently I have adopted a slightly new structure one that allows, at a glance a easy access to all my files, remembering that for many of my sites I use ready made CMS applications, such as Joomla and WordPress, as well as some home grown applications. Which means organisation to an extent is beyond my control as I am restricted to the sub-structures of said applications, but it allows me some top level control. In basic terms, my structure now looks as follows
- Webroot
- public_html
- TestBed
- Domains
- site 1
- Site 2
- Site 3
- Site 3 – Subdomain
- File Storage
- Backups
- safe_file_directory
- public_html
On first glance it looks the same, well of course it does, web structures are web structures, but when you dive into each directory you can see quite easily where everything lives, whereas before just about everything was placed under the public_html directory and was sorted by domain, there were also various other folders that held tests, downloads, file storage, backups and even each domain folder was held within this public root, and at one stage I had over 30 directories which each had multiple sub-directories and files, it went on for ever.
Now even my testbed holds properly organised folders, listed by domain and then the date of the test is listed in the name of the testbed directories, for instance “phpcoder” -> “cURL_test” -> “010108″ although it means I have multiple directories under each testbed, it also means that I can quickly find what I need to, especially when I look back months or even years in the future.
Each of my domain folders also hold (although I did not list it above) a sub-directory of “Staging” and “production” this isn’t the ideal way to have production and staging, but with .htaccess and other restrictions, it means in general terms everything is safe and there is very little chance of my production and staging environments conflicting and causing catastrophic failures.
Any downloads go into the file storage directory, that has a sub folder, for each domain and each category/product, again meaning everything is in one easy accessible place, it does sometimes mean altering settings in applications that use the downloads, but overall the payoff is worth it.
I have a logs directory also that stores logs, again as best I can, everything sits in a directory that identifies which domain the logs belong to.
From the above directory the one that i feel needs most explanation is the “Safe_file_directory”, whilst in reality it is names “safe_files”, I use this directory to store files and applications that need to be outside of the public root, in order to provide a greater protection, and again organisation.
Things don’t and shouldn’t stop there, I now review my structure on a bi-monthly basis, keeping an eye on any directory that has grown excessively, or improving the structure where new ideas come to mind, or when I find better advice. I also check to make sure I have been sticking to my file structure and move files and directories to their correct location when needed.
The final thing that I do in these reviews is make decision as to what information is superfluous and which information is required, the test bed is regularly cleaned and stripped of older versions of test scripts, in order to keep the space clean, usually I keep the last 2 – 3 revisions of the script, in case I locate bugs I have introduced and need to make cross comparisons, on these occasions I also refresh the staging environments to ensure they mirror the latest and most accurate code of the production directories, of course ensuring the database information points to the staging databases.
The possibilities are really endless to how you arrange your web directories, however what is important is that you find a clean and easily identifiable system, ensure that directory names are descriptive, no matter how long they are, and make sure you review and maintain it on a regular basis, and you will find that the more you maintain it the easier and better it becomes, eventually cutting your overall maintenance and work time significantly.
What I will say though, to start the re-organisation is to download your entire directory, plan and create your structure on your local computer first, possibly using a local web environment, and then either upload or execute this on your server, ensuring you run a test run of this first, plan for an outage and test before going live with your changes.
It may be hard at first, but you will thank your self later, that you took the time to spring clean your web hosting directory structure.







You know, according to Feng Shui, a messy workplace (or any place) is bad because they represent a delayed decisions. It's a kind of philosophical approach to why we should keep our desks, desktops, folders, and servers neat and tidy. I've always liked it.
I had never heard that one. I have a messy desk and desktop but that is more due to the erratic nature of my work. Being a Tech support manager, I do a lot of reactionary work and for a lot of clients, I have basic organisation of things, but other times things just get too busy and all hell breaks loose. I need to start applying my rigid web directories to my local environment
i call this my "raking the blog leaves" project this time of year. time not only to clean the sites, but my physical work area too
good reminder.
Good tips. Not quite sure of the file backups sitting into the 'domains'. Good job anyhow, thanks!