Are you looking for what is a root directory of a website? A root directory is a folder on the server or in cPanel that incorporates all of the contents or files of your website. It is the top folder in the directory, usually designated as public_html.
As a frequent internet user, you shouldn’t be shocked to know that all of your website files and folders are stored in one location on a server. Whenever anyone searches your domain on the internet, these content and files are processed hierarchically.
To make it easy, let’s begin this article with what is a root directory of a website and where to find the root directory of a website. Also, read What Is The Difference Between A Database And A Website?
What Is A Root Directory Of A Website?
The information that loads when users enter your website address into a Search engine is found in the webserver’s root directory. The term “Root” is called so because it is at the top of the hierarchy in the directory folders.
The root directory is a Unix-like operating system, and the root folders are marked with the slash “/”. This folder, which is sometimes referred to as public_html, htdocs, www, or wwwroot, holds the index files index.php, index.html, and default.html.
Among them, the root folder is always on the top of all folders. From the root directory, all the subsequent directories expand outwards. There could be multiple levels and subdirectories between the root directory (level 0) and the bottom-most subdirectory, as discussed in the next section.
Example of root directory: Our website domain is the root directory folder (level 0) and is represented as https://basicwebguide.com/.
The first level or subdirectory could be your pages like https://basicwebguide.com/about us/.
Similarly, there could be more sub-levels depending on the design of your website. But as a user, you don’t have to find the root directory folder in this way but get it from the cPanel.
Apart from these, the root directory stores libraries, media files, HTML codes, etc., under different subdirectory root folders. It also incorporates sensitive data or information like robots.txt and sitemap files.
Structure Of A Root Directory
From the above discussion, you got the basic idea of what is a root directory of a website. As discussed earlier, it begins with level zero and is distributed to sublevels as a branched tree. However, it works differently for a user and a search engine crawler.
Remember, all files inside your cPanel or hosting are not root directory folders; there could be settings or installation folders. The root directory folder usually begins from public_html/
Let’s understand it with a simple example of the root directory system of a website.
Application/ | Library/ | Templates/ | +-- config.php public_html/ +-- Media/ | +-- image1.jpg | +-- image2.jpg --- includes/ | +-- style.css | +-- script.js +-- index.php
As earlier mentioned, the root directory hierarchy begins from the moment where a visitor reaches your website via a browser. So, in the above example, the root directory folder is public_html/, whereas +– Media/ is the subdirectory or sublevels.
In the end, when a visitor visits your homepage, the +–index.php folder gets active. Remember, the files or folders that are not liable for being publicly exposed, like database login, are always outside the root folder.
How Do I Find Root Directory Of A Website? Where Is Root Directory Of My Website?
After knowing what is a root directory of a website, you probably looking for how to access the root directory. So, I will give you a brief overview to find root directory folders.
Depending on the hosting you are availing of, the root directory files can be accessed through cPanel, web hosting, or VPS hosting. Commonly, you find your root directory files of a website inside the public_html folder.
Method 1. cPanel
The easiest way to find the root directory of a website is by utilizing the cPanel (I’m supposing your site is hosted on cPanel). Nowadays, cPanel becomes the first choice of almost all site owners due to its simplicity.
- Log in to your cPanel (with username and password).
- Once logged in, scroll down, and look for the files section.
- Carefully look at the different folders; you can see the public_html folder.
- Now, click on the public_html folder, where you can access all the root folders or subdirectories relevant to your website.
Remember, all directories within the public_html folder must have 0755 permissions, and the public_html folder must always have 0750 permissions.
Method 2. VPS Hosting
VPS hosting is a virtualized version of a specialized physical server and has its own processors, memory, and disk storage. If you’re using VPS like DigitalOcean, Vultr, etc., then you can find the root directory using an FTP client like FileZilla.
Login to FileZilla using your host, username, and password. Type /public_html in the search box of site remote, and then click on the public_html folder. Now, you can locate your required root folders like wp-admin, wp-content, etc.
How To Find System Root Directory In Windows?
You shouldn’t be confused the root directory of a website with the root directory of a system like Windows. We already discussed what is a root directory of a website and where to find it.
To identify the drivers that are really that are being used, as well as the system log archives and troubleshoot failure dump files, navigate to the system root directory. Let’s see how to find root directory of Windows.
- Press Window and R key simultaneously; Win+R.
- Type Cmd in the program front and hit the Enter button.
- A Command Window will appear on your screen.
- Type set systemroot in front of the system user name (as shown in the above screenshot).
- The next line displays the SystemRoot (or system root directory) of your system; In our case, it is SystemRoot=C:\Windows.
It is all about what is a root directory of a website. In this article, we have comprehensively discussed what is root directory folder, why it exists, and how to find root directory of a website.
In simple terms, the root directory is the primary folder of your website’s all content and files. The root directory can be located through cPanel or FTP clients like FileZilla.
Also, it could have multiple subdirectories that depend on your website design and structure. I hope you like this post; any queries and suggestions are welcome.