Now that we’ve installed WordPress 3.9 on a Domain, Addon Domain and a Subdomain, I want to walk through the file structure for you.
Web Server Root
Let’s go back over to the File Manager. By default on almost all hosts when you install WordPress on your primary domain, it goes into what is called your web server root. When we just clicked on File Manager, it took us to the hosting account root. What I want to draw your attention to is the fact that routinely people tell you to go to your root directory. When I say that it has 3 potential meanings.
Finding the Root of a WordPress Website
If the term root directory is used in a very general context of working inside your hosting account, it can mean this right here. That is a (/home1/byobboot). That is the root of my hosting account and every single file, every piece of mail, everything I do in it is stored inside of that.
Well, inside of that is the web server root and the web server root is public_html. This is the case in most hosts. It doesn’t have to be the word public_html. Some hosts don’t even use that but most hosts do. So, public_html is generally your web server root and so anything that’s going to show up on your website and be processed by the web server has to be inside of this web server root.
In this case, inside public_html we have this Bluehost thing, cgi-bin. This has nothing to do with us and we don’t care about it. It could be deleted if we wished to do so. We have the two WordPress installations that we created, that is the genesiscrashcourse and the lesson1. And then we have WordPress folders and WordPress core files.
WordPress Core Files
WordPress folders are wp-admin, wp-content and wp-includes. Then you have a bunch of core files. Some of these are not core files like this MOJO stuff and ss_installer these actually came along with the MOJO installation so it doesn’t have anything to do with WordPress per sé. But most of these files that didn’t exist before are all specifically related to WordPress functioning and are considered part of your WordPress core files.
Now, if we come over to lesson1, you see we have exactly the same set of files here and the same set of folders, wp-admin, wp-content and wp-includes. All of these files down here, these are all necessary for running WordPress.
Hosting Root, Web Server Root and Website Root
So you have your hosting root which is this (/home1/byobboot) root, you have your web server root which is public_html and then you have your website roots. Notice the distinction between web server and website.
The website root for genesiscrashcourse is this folder here. We are now in the root of genesiscrashcourse.com. The website root for lesson1.genesiscrashcourse.com is this folder called lesson1 and this is the website root for this website.
Now, for byobbootcamp.com, that website root is the same as the server root in that all of its files start inside of public_html. So just bear in mind that you have 3 types of root directories that you can be talking about when somebody says, “Go to your website root”.
Typically you’re not actually interacting with this very much but if you never get introduced to it when you see it, it can be confusing.
Why It’s Important to Keep the File Structure Organized
Every time you install WordPress, you create a new set of them which is one of the reasons why it’s important to be very clear about your file structure because the folders and files are all named exactly the same.
This is one of the reasons why I believe that it’s best, with the exception of the WordPress installation that is on your primary domain, to keep all other domain files in their own folder inside of the root of your web server.
So if we had 10 other WordPress installs that would be 10 other folders in here. Each one of them would contain all of the WordPress files. So that’s what goes on here.
So now you should have this concept of the files for your primary WordPress domain being in the root of your web server, that is they’re in public_html. And the files for your other domains are in these directories that were created when we activated those domains. That happened either when we made it an addon domain or when we made it a subdomain.
2 Types of WordPress Files
WordPress has essentially two types of files. It has core files and it has essentially customization files. All of the core files are contained outside of these two folders. For example, wp-activate, wp-blog-header, wp-comments, wp-config, wp-cron. These are all core files that are in the root of the WordPress installation.
So we’ve got our core files which are these files here plus everything inside of wp-admin and everything inside of wp-includes. You will never ever edit these files. There is one small exception. There may be reasons for you to edit wp-config but generally speaking, you will never edit a core file. If a file is ever edited, it’s in wp-content which is the folder where WordPress stores plugins and themes that you install.
Typically, you will never do any editing to your file period. But if you’re an advanced user you may choose to edit some of your theme files. If you did that you would be doing that inside of this themes directory inside of the theme file of the theme that you’re using. However, a very large percentage of you is never going to edit any of the files in WordPress.
If you have some web design experience and you are accustomed to creating websites using files where you create a file for one page and you create a file for another page, that’s not the way WordPress works.
We’ll show you how WordPress works but WordPress saves all that content in a database and never actually generates a file. So if you’ve got a page say, “My favorite pet pictures”, there’s never a file called that anywhere because WordPress doesn’t work that way. All of that content is already stored inside of the database and is generated on the fly when it’s requested. And that is the WordPress file structure.