Files on your server

Multiple choice

You can have as many subdomains as you want on your Reclaim domain. What's so cool about that?

Saving
A

Each time I create a subdomain, I get entered in a lottery for a puppy!

B

I get free server disk space for each subdomain I create.

C

I can have more than one website on the same domain.

D

People with more subdomains are more attractive.

Not graded. So why do it?

Lesson contents

Let's get some files on your new exercises subdomain.

The File Manager

In cPanel, start the File Manager. It's like Explorer in Windows. Explorer shows you the files on your PC. File Manager shows you the files on your server.

The FM has different parts to it.

File manager parts

There are folders on the left. The files in the currently selected folder are on the right. Actions you can take on folders and files, like copy, and upload, are above the folder and file panes.

Subdomains are folders

In the folder's section, look for a folder for the exercise subdomain you created. Mine is called exercises.kieranmathieson.com (on the account I'm using for this lesson). Click it.

Subdomain folder

Ignore the two folders inside exercises.yourdomain.com. cPanel made them when it created your subdomain. We won't be using them.

Any files you put inside the folder exercises.yourdomain.com, appear on the website at https://exercises.yourdomain.com. So, to put a file on the web, just put it in a folder on your server.

Ray
Ray

Seriously? You just put a file there, and it's on the web?

That's right.

Note

In this case, the subdomain and the folder have the same name, exercises.yourdomain.com. But the names don't have to be the same; it's just the way cPanel names them by default.

Each subdomain has an associated folder.

Same with your main domain. My main domain is kieranmathieson.com. It's folder it public_html.

Main domain

Any files I put in public_html will be on the web at https://kieranmathieson.com.

Why the name public_html? That's the name Reclaim made. Folders for main domains are often called public_html. It's an industry standard.

Add a file to your subdomain

Select the folder for your exercise subdomain, and click the "+ File" button to create a new file.

Create a new file

Type in a file name, with an html extension. Whatever name you like, but lowercase, and dashes for spaces.

Creating a file

Edit the file. Right-click on it, and choose Edit (not HTML edit).

Edit

(If you get a message about text encoding and UTF-8, you can ignore it. We'll always use UTF-8 in this course; in fact, that's all I ever use, on any project. More about what UTF-8 means later in the course.)

You're editing the file directly on the server. This isn't a good idea, generally. It's better to edit files on your own PC, and then upload them. But for now, it helps to edit on the server, so you can learn how things work.

Type whatever you like in the file. I typed:

  • <h1>Rosie</h1>
  •  
  • <p>Rosie is a good dog.</p>

Content

Save the file. Not with Ctrl+S. Use the "Save Changes" button in the upper right.

Save changes

To the browser

OK, you've got a file in the folder exercises.yourdomain.com on your server. Remember that files in the folder, should be on the web at https://exercises.yourdomain.com.

So, if you made the file rosie.html in the exercises.yourdomain.com on your server, it should be available at https://exercises.yourdomain.com/rosie.html. Let's check it out.

Note

If you didn't set up HTTPS, the file will be at http://exercises.yourdomain.com (the s is missing from the protocol). However, you should always set up HTTPS, on every domain and subdomain.

Point your browser at https://exercises.yourdomain.com/rosie.html. Or whatever you called your file.

Directory privacy

You can protect your subdomain so that only someone with a username and password you create can see the content. The username and password are just random things you make for this sole purpose. They shouldn't be names you use anywhere else.

Click the Directory Privacy link in cPanel.

Directory Privacy in cPanel

You'll see a list of things you can protect. I'll protect animalrescue.kieranmathieson.com, where I put a game I wrote for my grandson.

Save the deer

Click the Edit button for the thing you want to protect.

Editing privacy

There are two steps:

  • Tell cPanel you want to protect the folder.
  • Give a username and password.

For the first step, check the Protect checkbox.

Protect checkbox

cPanel will fill in the name. Ignore it. It doesn't matter to us.

Checked

Click Save. You should get a confirmation:

Confirmation

cPanel will then ask you for the username and password. Use something you don't use for anything else. I used burt and BurtyBurtBurt. You can try the game if you like.

Username and password

That's it! The Directory Privacy screen will show you the folder has been protected.

Protected

Back to Rosie

OK, I protected exercises.kieranmathieson.com the same way. Here's what I see at Rosie's URL:

File in browser

Typing in the username and password, I see:

Output

The bottom line: to put a file on the web, put it in a folder on your server.

Subfolders and URLs

You'll need an image file for this bit. You can use this one, if you like:

Rosie

To save the image file on your PC, right-click the image, and select "Save image as...", or whatever your browser calls this action.

Save image as

Use another image, if you'd prefer. Just make sure its extension is jpg or png.

Make a subfolder in exercises.yourdomain.com, called images. There's a "+ Folder" button in FM.

+ Folder

images created

Open images (double-click it), and inside that, make another folder called cute-dogs. Or cute-turtles, or whatever appeals. It's a sub folder of images, which is a subfolder of your subdomain's folder. So it's a subsubfolder. But that gets complicated, so we'll call it just a folder.

Open the folder (click on it).

Current folder

Upload your image file. File Manager has a button that will upload files to the current folder.

Upload

Hint

If you don't see the file or the folder, use the Reload menu item in FM:

Reload

So now, you should have an image file in the subsubfolder you made.

Image file in subsubfolder

Check the image in a browser

The path to the image on your server is exercises.yourdomain.com/images/cute-dogs/rosie1.jpg. Or however you named things.

Now, the server folder exercises.yourdomain.com maps to the URL https://exercises.yourdomain.com. So your browser should be able to find the image file at https://exercises.yourdomain.com/images/cute-dogs/rosie1.jpg.

Type in your URL, and see if your browser can get the image from your site.

Rosie!

She's such a cutie!

Uploading with Mate

Evan's video

Evan asked for a video on organizing files. Here it is.

Exercise

Exercise

Files in subfolders

Find an image of an animal you like. A llama, dog, octopus, whatevs. Put it in a folder on your exercises subdomain. A folder in a folder is OK, too, as many levels deep as you want.

Submit the URL of the image. Also submit the username and password needed to access the image.

Summary

  • Each subdommain maps to a folder on a server.
  • Put a file in that folder, and it's on the web.

Up next

Let's make it easier to upload many files at once.