File Structures

Web hosting is, at it's basic core, files and folders on a computer that is connected to the internet and setup to distribute them. How that computer (typically a server) is setup to do that is covered more in LAMP Environments but this article will unpack the idea of the file structure and how it relates to what you view on your domain. When you signed up for your domain a web hosting account was created. Although you typically will interact mostly with the web interface to create subdomains, install applications, and other common tasks, you might occasionally also need to work directly with the files in your account. The File Manager in your control panel is one way to see these files. You can also create an FTP account (FTP stands for File Transfer protocol and it's a way of using a desktop client to transfer files to and from your space) in your control panel and use an FTP program to interact with these files.

Let's take a look at the File Manager built into your control panel to get a better understanding of the file structure that makes up your website(s). When you navigate to the Websites and Domains tab you'll see the File Manager icon among the list of options on the screen. Go ahead and click on that to open it up.





You'll notice when the file manager opens up that this looks very much like a folder on your computer. There are a few folders in it as well as files, and you can navigate down into those folders and see what's inside of them. At the top of the file manager you also have the option of interacting with files and folders you select by moving them around or removing them. There is a larger article all about how to use the file manager at Using the File Manager so we won't talk much about how the interface works, rather what those folders and files actually mean and how they relate to what someone sees when they visit your website.

By default you have a variety of folders at the root of your web host (the first screen you see when you open up the file manager). Some of them are created automatically to store information about the panel and setup of certain sites. These folders are things like anon_ftp, cgi-bin, pd, private, and statistics. You can safely ignore most of those folders because they don't correspond to actual websites. Let's look at which folders do and how it all works.

Your main domain, mydomain.com, corresponds with a folder called httpdocs. Whatever files and folders are inside of this folder are available at that domain. If you installed Wordpress here you'll likely see a lot of Wordpress-related files within it (which were probably helpfully put there by the automated installer). Let's say we uploaded an image called mypicture.jpg into the httpdocs folder. That image would now be available at mydomain.com/mypicture.jpg. The slash after your domain implies "this file is inside this folder". But what if we had a folder inside the httpdocs folder? How does that appear? This is typically called a subfolder so let's put a folder in httpdocs called "images" and put our image, mypicture.jpg, inside of that folder. What would you type in a browser to get to that file now? The location would be mydomain.com/images/mypicture.jpg. So subfolders are also indicated by a forward slash after a domain.

So we understand how to put things on our main website, and keep in mind if you're using software like Wordpress or Drupal much of the work is done for you in that regard. What about subdomains? We know that we can have completely separate sites called subdomains that appear as nameofsubdomain.mydomain.com. But where are they in the file structure? When you created your subdomain the control panel asked you to give the folder a name. If I had a subdomain called photos.mydomain.com for example, I might want to name the folder "photos" (by default your control panel will call the folder Site1, Site2, etc which is not very helpful for remembering where those files live). Folders for subdomains are located at the root of your file structure, the same area where the httpdocs folder was located. So when you go to the File Manager you'll see folders listed for all of your subdomains and once you navigate inside one of those folders you'll see files and folders specifically for that subdomain that appear on the web at that subdomain's address.

The File Manager in your control panel is great to view these files and folders, but it can be limiting if you want to upload an entire folder of information to your website. If you find yourself wanting to do more with the files and folders on your web space you can download an FTP program like Filezilla and connect to your website by creating an FTP account in your control panel (also located in the Websites and Domains tab). An FTP program will allow you to upload and download an unlimited number of files and folders quickly.