The root directory contains all the critical files and folders that power your website. But some site owners may not even know it exists, or how to access it.
By familiarizing yourself with the root folder, you’ll be able to manage your site more effectively. For example, you’ll know how to locate it to make file modifications or troubleshoot issues.
In this post, we’ll take a closer look at the root directory and what it contains. Then, we’ll show you how to access and navigate your website folders. Let’s get started!
An Introduction to Root Directories
The root directory contains core files and folders needed to run your website. It also houses elements that you upload to your site, such as themes, plugins, users, media files, etc.
Most website owners manage to create and maintain websites without ever needing to access the root directory. But there are some situations when you may need to edit specific files.
For instance, you might want to modify the .htaccess file to implement custom server-level rules.
Understanding your site’s folder structure also enables you to troubleshoot technical issues. For example, if you get locked out of the dashboard, you can dig around in the root directory to find the source of the problem.
If you fall victim to website hacks, you’ll want to access the root folder to check that your files are free from malicious code.
Plus, some website owners prefer to install plugins or carry out software updates in the root folder, rather than through the WordPress dashboard.
What Does the WordPress Root Directory Contain?
Every WordPress installation comes with a root directory that contains critical files and folders that power your site.
For a standard configuration, you’ll find three main folders:
- wp-admin contains files needed for the admin interface to function properly.
- wp-content supports themes, plugins, and uploads, as well as the index.php file (which ensures that your website displays properly in a browser).
- wp-includes houses the remaining files required for core functionality.
You should also see a list of files in the root folder. This includes important components like php.ini, robots.txt, wp-blog-header.php, and wp-login.php.
If you’ve created a subdirectory, its folder will also reside in the public root directory.
Two of the most critical files in the root directory are the .htaccess file and wp-config.php. The former contains configuration settings (like redirects and permalinks) while the latter stores database connection details.
These files are typically created after the installation. They’re also the only files you should consider editing on your own. Still, you’ll want to back up your site first and proceed with extreme caution.
How to Access Your Website’s Root Directory (3 Ways)
Now, let’s look at the three main ways to access your root folder.
1. Use File Manager
Most web hosting providers offer a File Manager that is accessible within your hosting provider’s control panel. This might be cPanel or a custom solution.
However, not all web hosts let their clients view/edit files and folders in the root directory. That’s why you should choose a quality web hosting company like NameHero:
NameHero offers cPanel access, which makes it easy to manage your directories, files, and folders. Better yet, most of our hosting plans come with free domain names, SSL certificates, and advanced security features.
Once you’ve opened cPanel, you’ll need to visit File Manager to locate your website’s root folder. This is usually labeled public_html. It can also be called www or htdocs, or contain your website’s name.
At this point, you should be able to see the entire file system for your site.
2. Use FTP
If your hosting provider doesn’t offer File Manager, you can connect to your website files via File Transfer Protocol (FTP).
First, you’ll need to install an FTP client like FileZilla. Then, you have to supply your FTP credentials.
You should have received these via email when you signed up for a hosting account. You can also find them in the control panel.
These details include your host’s key, username, password, and port.
Once you’ve connected to your site, open the root directory. Here, you’ll find the entire file system displayed to the right of the interface:
Meanwhile, all your local computer files sit on the left-hand side.
3. Use the Admin Dashboard
If you only need to access the root directory to modify plugin or theme-related files, you could technically use the admin dashboard.
However, we only recommend trying this if the previous two methods don’t work, since it can be risky. And as always, be sure to make a fresh backup before you continue.
To get started, go to Appearance > Theme File Editor in the backend:
Typically, you’ll need functions.php or style.css to change the look or functionality of your theme. Once you’ve made your edits, click on Update File.
If you need to access the code of your plugins, navigate to Plugins > Plugin File Editor. Then, use the dropdown box in the top right corner to choose the relevant plugin and click on Select.
At this point, you should see all the plugin files in the column to the right while the file content displays to the left:
Note that it isn’t a good idea to modify active plugins since it can introduce compatibilities that may break your site.
How to Navigate the Root Directory
Now that you have access to the root directory, let’s take a look at how to navigate the main branches.
As we discussed earlier, there’s a distinct hierarchy within the root directory, with files being stored within folders. You may also have subdirectories located here.
The first folder you’ll usually see is wp-admin, which stores all data related to the administrative backend. It’s best to avoid making direct changes to these files since they can be overwritten during core updates. Instead, we recommend using child themes.
After that, there’s the wp-content folder, which contains the elements you upload to your site. Within the folder, you’ll find the following items:
- A theme subdirectory (labeled themes). Here, you’ll see a separate folder for each theme you’ve installed.
- A plugin folder (labeled plugins). Each folder corresponds to every plugin on your site.
- An uploads subdirectory (labeled uploads). This stores media files like images and videos. It’s usually sorted by year/month.
You may also find these items:
- A translations folder (labeled languages) that houses language files for non-English sites.
- An upgrade folder (labeled upgrade) that may appear temporarily when you upgrade to a new version.
- Custom subfolders and files, which may be added during custom development work, or by plugins.
The last of the main folders is wp-includes. Here, you’ll find CSS, JavaScript, and PHP files that support the remaining features that enable your site to run properly.
Unless you know what you’re doing, it’s best to leave these files alone. Changes can result in security vulnerabilities and potential breakdown of functionality.
Conclusion
Every default WordPress installation contains a root directory that houses critical folders that run your website, including wp-admin and wp-content. You may see other folders if you’ve set up subdirectories or used custom development solutions.
These folders branch out into further folders and/or files. For example, wp-content stores folders that contain plugins, themes, and media files, but it also houses the index.php file. Typically, you’ll access the root directory via File Manager. But you can also connect to it from your operating system via FTP.
Do you have any questions about your website’s root directory? Let us know in the comments below!
Sophia is a staff writer at WordCandy.co, where she produces quality blog content for WordPress plugin and theme developers, hosting providers, website development and design agencies, and other online businesses.
Leave a Reply