CHAPTER 57 · HTML

Publishing a website: files, hosting and final checks

Move from a page on your device to a site other people can open. Learn the steps and checks without needing to buy a service for this lesson.

Download example files (ZIP)

Local is not public

Opening a saved file shows it on your device. The address often begins with file:. A classmate cannot use that address to read a file from your laptop. A web server answers browser requests. A host provides a place where that server can make your files available. Publishing means putting the right files there and checking the real addresses.

Domain, DNS and HTTPS in plain words

A domain name is a readable address such as the name of a school website. DNS helps browsers find where requests for that name should go. A host may offer a provided address, so a custom domain is not always needed for a first practice site.

HTTPS protects information while it travels between browser and server. It does not prove every page is honest, fix broken HTML or build a form backend. Hosting setup and domain settings depend on the provider. Follow its current instructions; keep account access and private keys out of public folders.

What a static host can do

A static site serves saved resources such as HTML, CSS, JavaScript and images. Browser JavaScript may still make it interactive. A backend is code running on a server to perform jobs such as checking a login or storing a request. Uploading a form HTML file does not create that receiving service. The local GET project in Chapter 59 will display practice values in the browser only.

Prepare a tidy release folder

A release is the set of files you intend to share together. Include every used page, stylesheet, script, image and media file. Keep relative folder positions unchanged. Do not upload local secrets, unfinished drafts or private notes.

Many hosts use index.html as the default page for a folder address. That is a server convention, not a special HTML element. Our two exercise files keep their displayed names, so their links keep working. If you rename a page to index.html, update every link to that old filename and test again.

Test with local HTTP first

A local HTTP server helps you test browser behaviour closer to a hosted site. It is not public hosting. If Python is already installed, open a terminal in the extracted example folder and run this command. On Windows, use py instead of python if that is your installed command. You do not need to install Python just to read the tutorial.

Example fragment — use inside a complete program
python -m http.server 8000 --bind 127.0.0.1

Open http://127.0.0.1:8000/publish-start.html in the browser. The port 8000 identifies this local server. If it is busy, choose a different unused port and use that number in the address. The bind option keeps this practice server on your own device. Keep the terminal open while testing; press Ctrl+C there to stop it. This simple server is for local practice, not production hosting.

Paths and letter case matter

A link such as project-session.html starts from the current document folder. A link beginning with / starts at the site root; that can fail when a site is published under a subfolder. Match spelling, letter case and file extensions exactly. A filename that works on one computer may fail on a case-sensitive host. Use forward slashes in web paths and avoid links to your private drive letters.

After upload, open a deeper page by its complete address in a new tab and refresh. A working home page does not prove every destination exists. A single-page application may need routing configuration; our plain two-page exercises are separate HTML resources.

Read request results

In browser developer tools, the Network panel lists requests and their results. A status code is the server's short numeric result. 200 commonly means the resource was delivered successfully. 301 or 302 commonly sends the browser elsewhere. 304 can mean a stored copy is still usable. 404 means the requested resource was not found; 403 commonly means access was refused. A 500 response indicates a server-side failure. Check the requested URL, not only the number.

A 200 response containing the wrong fallback page is still wrong for a requested image or stylesheet. Check the response type and content. The browser console can help find script errors; it does not prove every link or teaching statement is correct.

Publish, verify and keep a way back

Choose a suitable host, upload the release folder using its supported process, and use its public HTTPS address. Test links, direct page URLs, refresh, images, forms and narrow screens again. Ask another person to open the link on their device. Check that you did not share a localhost address.

Keep the last working release so you can restore it if a change fails. A fresh tab and a checked network response help identify old cached files. Do not ask every visitor to clear all their browsing data as the normal release process. This lesson prepares and checks files; it does not upload anything or register a domain for you.

Follow the idea

From local files to a public site
  1. 1Prepare the complete folder
  2. 2Test locally
  3. 3Upload through your host
  4. 4Check the real HTTPS addresses

Keep the previous working release.

Complete program: publish-start.html

Save this as publish-start.html. Open it in your browser.

publish-start.html
<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>Local Publishing Practice</title>
  </head>
  <body>
    <h1>Prepare a small site for publishing</h1>
    <main>
      <p>This is a local practice site. It has not been uploaded by opening this file.</p>
      <nav aria-label="Practice pages">
        <a href="publish-checklist.html">Open the publishing checklist</a>
      </nav>
      <section>
        <h2>Keep the files together</h2>
        <p>
          Save publish-start.html and publish-checklist.html in the same folder. Test the link and
          its return link before uploading.
        </p>
      </section>
    </main>
  </body>
</html>
Browser previewDocument title: Local Publishing Practice

This preview shows the example in a browser. Save the complete code in local files to test links between pages and downloads. Same-page section links work here.

Expected result: a start page with a checklist link. With both files saved together, the link opens the checklist.

Complete program: publish-checklist.html

Save this as publish-checklist.html. Open it in your browser.

publish-checklist.html
<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>Publishing Review Checklist</title>
  </head>
  <body>
    <h1>Check the site before sharing</h1>
    <main>
      <p>A successful upload needs more than a page that opens on your own device.</p>
      <ul>
        <li>Open each page directly and refresh it.</li>
        <li>Check every local image, stylesheet and link.</li>
        <li>Test keyboard use, a narrow screen and browser zoom.</li>
        <li>Check the public HTTPS address after uploading.</li>
        <li>Keep a copy of the previous working files.</li>
      </ul>
      <p><a href="publish-start.html">Return to the practice start page</a></p>
    </main>
  </body>
</html>
Browser previewDocument title: Publishing Review Checklist

This preview shows the example in a browser. Save the complete code in local files to test links between pages and downloads. Same-page section links work here.

Expected result: five review items and a return link. The return link opens publish-start.html. The list reports tasks to check, not automatic test results.

Problem and solution

Problem: your main page works after upload but the image and second page fail.

Solution: inspect the exact requested paths. Confirm that both resources were uploaded with the same names, letter case and folder positions. Open them directly, correct the paths and repeat the test at the public address.

Common mistakes and useful tips

  • Do not share a localhost address as your public website.
  • Do not upload only the HTML when it uses separate resources.
  • Check case and subfolder behaviour.
  • A static contact form needs a real receiver before it can send messages.
  • Keep a working release before replacing files.

Practice questions

  1. Can a classmate open your file: address from their laptop?
  2. What does hosting provide?
  3. Must the start page always be named index.html?
  4. Why test a deep page directly?
  5. What does 404 suggest?
  6. Test both practice links, then change one destination to a missing filename. What should you inspect?
Check your practice answers
  1. No. It points to a file on your own device.
  2. A place and service that can make website resources available to browsers.
  3. No. Many hosts use that default, but configuration and direct file addresses can differ.
  4. The home page may work while a destination or server route is missing.
  5. The requested resource was not found. Check the exact URL, filename and upload.
  6. Inspect the requested address and Network result, restore the correct filename and test both directions again.

Interview questions

Does HTTPS create a working form backend?

No. It protects data in transit. The receiving application must still exist and handle the request.

Why can letter case cause a publishing problem?

The local filesystem and host can treat case differently. Exact matching avoids a link depending on local case-insensitive behaviour.

What is the difference between static hosting and backend processing?

Static hosting serves prepared resources. Backend code can perform server-side tasks such as storing a submission or checking permissions.

Does a 200 response always mean the page is correct?

No. The server may deliver the wrong fallback document or wrong content. Check the resource and visible behaviour as well.

Quick revision

  • Local testing and public hosting are different.
  • Upload resources together and preserve paths.
  • Verify direct addresses, refresh and HTTPS.
  • Keep a copy of the previous working release.