What directory should I put my site page or files in?

Date: October 8th, 2016 | Category: FTP

Hosting Directory Structure


Its very important to know about the directory and structure of your hosting space. If you are going to upload your site pages or documents under your hosting space then you will need to know which and where to upload files so they apear where they should be. The specific directory you will upload them to will depend on whether you are working with the main domain, an addon domain, or a sub domain. Also uploading content under a sub folder matters In this article, we discuss how to determine which folder to work with.

Directory and File Structure

In this section we use www.yourdomain.com as your domain and your cpanel username is user1

A accounts document root, also known as the home folder, is the main folder that contains all of the files for either a domain or a subdomain which will go online for users.

Main Account or Site  ( www.yourdomain.com )

The document root for your main site is your public_html folder. This means when someone visits your main domain, the server returns files that are located in the public_html folder.

Subdomains

If you created any subdomain then the document root for a subdomain is a bit different. DNS handles pointing of subdomain and If your subdomain is http://store.yourdomain.com, then the document root folder would be public_html/store.
Subfolder ( www.yourdomain.com/blog

If you have a blog subfolder for your main site then the root for the subfolder will be public_html/blog

Addon Domains ( adding www.yourdomain2.com)

If you signup for Addon domain with current hosting package then Addon domain document roots are very similar to subdomains. If there is an addon domain on your account, the main folder is also under the public_html folder. For example, if you have an addon domain named http://www.yourdomain2.com on your hosting package, the document root would be public_html/yourdomain2.com. We have explained in chart as below.

Website Website Path Directory Structure
yourdomain.com http://www.yourdomain.com public_html
store.yourdomain.com http://store.yourdomain.com public_html/store
yourdomain.com/blog http://www.yourdomain.com/blog public_html/blog
yourdomain2.com ( addon) http://www.yourdomain2.com public_html/yourdomain2.com

Which files opens by default : 
The directory index file will be the first file the server loads from a folder .
Web server will check for the existence of one of the below files and based on the order specified below, display it’s content as the Home Page, when anyone tries to list the content of any folder/directory:

  1. index.html
  2. index.htm
  3. index.php

If you have a site page index.php uploaded under public_html/index.php then when you got to your site www.yourdomain.com then it will check index.php file and opens which is there. If you do not have any index the server does not find any of these files then it will show Directory index there with file location.

If you have default.html, mysite.html , Welcome.html, Home.html ( and your main site is www.yourdomain.com/Welcome.html) which many application generate by default then you will need to modify your .htaccess file ( pending)  and set your Directory Index setting to match that of website’s first page. so when you go to your site it opens the correct page.

You will just need to put the code given below so it opens Welcome.html in first place. It will open Welcome.html file even if you have index.html file there as its indexing there.

DirectoryIndex Welcome.html

Article published on Sibername Help Center - http://www.sibername.com/tutorials

Print this article!