How to Find Root Directory of WordPress Website & Upload Files

Jan 2, 2018
upload file to the root directory of wordpress

While working on your websites, you may encounter the need to access what is referred to as the root directory, root folder, document root, or some other alternative. The following article contains instructions on how you can view/access this folder.

If you are managing the technical work of your website then a lot of time you heard these two terms “Upload file to the root directory of your website” or “Upload file to the public_html folder“, I’m right. Well, both these terms have the same meaning and referring to do the same thing.

upload file to the root directory of wordpress
upload file to the root directory

What is the Root Directory?

Root directory means the folder which contains all the file of software (like a window, C-drive is the root drive of window) and

Public_html, if you working on a server (hosting) then root directory refers to a public_html folder (we can say, its a C-drive of the Cpanel, where all installed files of the WordPress is stored).

It does not matter which taxonomy “Upload file to the root directory of your website” or “Upload file to the public_html folder” you are using to upload a file.

In a computer file system that is organized as a pyramid or tree, the root directory is the directory that includes all other directories. (Unlike a real tree, a hierarchy file system has only one root!) In UNIX-based as well as in other operating systems, the root directory has no name. It is simply characterized by the special character that separates directories in a file system.

If you need to upload files to the server, then you have to find the root directory first and that’s what we are exactly going to do in this article.

The Primary purpose of this article is to explore the way to,

  1. How to find the root directory of WordPress website
  2. How To upload the file to public_html folder

So, let’s us start.

How To Find Root Directory Of WordPress Website

The root directory is the folder that stores all the files for your website and that folder name is public_html on the server (Cpanel). By default, it’s your primary domain folder.

For example, If “exmaple.com” is your primary website name then your root directory is “public_html/”

But, when you add the Addon domain to your Cpanel, it will create a new folder in your “public_html” folder.

For example, Suppose I add “example2.com” in my Cpanel then “public_html/exmaple2” Is my root folder for the “exmple2.com” domain.

Note: The document root for a subdomain is a bit different. If your subdomain is “abc.example.com”, then the document root folder would be “public_html/abc”.

Let’s we find the root directory of my hitechwork to visualize it.
  • Login your Cpanel and open your File_Manager.
find root directory of wordpress website in cpanel
find the root directory

Note: Hitechwork.com is my primary domain, so the root directory of hitechwork.com is “public_html” by default.

As I told you, all the new domain or subdomain, You will add in the Cpanel, it will be added, under the public_html folder.

  • Have a look at the below screenshot.
find root directory of addon domain
find root directory of the addon domain

All the new domain is added in the public_html folder.

Note: You can also install WordPress into subdirectory WordPress during installation.

If you are not sure about the root directory of addon domain then you also can check it by;

  • Login you Cpanel and click on Addon.
addon domain option in cpanel
addon domain option

Note: Addon domain is an additional domain which you host on the same server.

  •  Here you can see you all addon domain and its root directory expected your Primary domain.
addon domain root directory find in cpanel
addon domain root directory finds in Cpanel

addon domain root directory you can also edit the path or redirect website A to website B if you want.

Quick table guide to understanding Document Root Structure

Domain typeURL pathFile Structure
Main domainhttp://example.compublic_html
Subdomainhttp://store.example.compublic_html/store
Addon domainhttp://example2.compublic_html/example2.com

In this way, you can find the root directory of the WordPress website.

So, let move to our next step.

How To Upload File To The Root Directory Of website

There is a lot of methods to upload the file to the root directory, for example by using the FTP account, From Cpanel, From inside the WordPress.

Below is some case when you need to upload the file to the root directory.

  1. When you have to Upload XML sitemap file to WordPress
  2. When you have to Upload robots.txt file to WordPress
  3. When you have to verify website with HTML file Upload method
  4. Or have to verify third-party services like Zoho mail, mailer lite, MailChimp, etc.

To upload a file, click on File_Manager in the Cpanel and find the root directory where you want to upload the file.

Note: Here I’m going to upload the file to the root of my primary domain.

  • Select the root directory and click on upload.
upload file to root folder
upload file to the root folder

When you click on upload a new window will be open with the upload option.

  • Select the file that you want to upload and hit the submit button.
select upload file to upload in cpanel
select upload file

It’s done. your file is in the root folder. If you are using WordPress then you can use a plugin called File Manager. But sometimes this plugin does not work because your hosting not allowed to upload files due to security reasons.

  • Install and active File Manager Plugin on WordPress.
  • Click on File Manager, Select the root directory and upload the file
upload file using plugin
upload file using the plugin

If you don’t have access to Cpanel and this method does not work then you can use the FTP account method. To get the login detail of the FTP account, contact your hosting provider.

So, in this way, you can upload the file to the root directory of the WordPress website.

FAQ’s

Is Public_html the root directory?
The public_html folder is the webroot for your primary domain name. It means that public_html is the data folder where you put all website data files which you want to appear when someone types your main domain (the one you provided when you signed up for hosting).
How do you get to the root directory?
For the Grid, a website’s root directory is it’s /HTML folder. This is located in the file path /domains/example.com/html. The root directory of the website can be viewed/accessed through File Manager, FTP, or SSH.
What is a website root directory?
The root directory of your website holds the content that loads when a visitor searches your domain name in a browser. For example, you need to put your index file in your website’s root directory for all the visitors to see your site. For your main primary domain name, your website’s root directory is /public_html.

Recommend Post

Remember to share this post with anyone who might benefit from this information, including your Facebook friends, Twitter followers, and members of your Google+ group!

Also Support Us By Liking Our Facebook, Twitter, and Google+ Page.

If you have any suggestions or problems with “how to find the root directory of the WordPress website,” then please feel free to comment below.

Fawad Yousuf
Follow me
2 thoughts on “How to Find Root Directory of WordPress Website & Upload Files”

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top