How to Deploy a Static Website Step by Step
A static website is made of ready-made files: HTML, CSS, JavaScript, images, and so on. Because nothing is generated on the server for each visit, static sites are fast, inexpensive to host, and have little to patch. Deployment means getting those files onto a host. The details differ by provider, so follow your host's current documentation, but the process is similar everywhere.
Step 1: Build your site
If you wrote the files by hand, you are ready. If you use a generator or build script, run the build to produce an output folder, often called dist, build, or public. This folder is what you deploy, containing an index.html for the home page and all other files. Open it locally or through a local test server to check that links, images, and styles work. See static hosting and Jamstack explained.
Step 2: Check the basics before uploading
- All links use paths that work from the site's root, and no links point to your own computer
- Images are compressed. See how to compress images for the web
- Pages have titles and descriptions. See how to write title tags and meta descriptions
- Forms send to a working endpoint, since a static site has no server of its own to process them. Services exist for this, and many support spam protection. See website spam protection for contact forms
- You have a sitemap and robots file if you want them. See what is a sitemap.xml and robots.txt explained
Step 3: Choose a host
Many hosts serve static sites, some with free plans for small projects. Compare limits, features such as forms and redirects, support, and how easy it is to move away later. See how to choose web hosting.
Step 4: Upload the files
Common methods:
- Drag and drop. Some hosts let you drop your output folder into a web page to deploy it. Simple for small sites.
- Connect a Git repository. Push your code to a repository, link it to the host, and each push triggers a new deployment. Good for ongoing changes and rollbacks.
- Command-line tools or file transfer. Useful for automation or traditional hosting.
Make sure you upload the contents of the output folder so that index.html sits at the top level.
Step 5: Configure redirects and headers
Add redirects for any old addresses. See 301 redirects explained. You can usually set security headers through a configuration file or settings page. See website security headers explained.
Step 6: Connect your domain
Add your custom domain in the host's settings, then update DNS records as instructed. Decide between www and non-www, and redirect the other. See how to point a domain to your website, www vs non-www, and how DNS works for website owners. DNS changes can take time to spread.
Step 7: Turn on HTTPS
Most static hosts issue certificates automatically once your domain is connected. Make sure HTTP redirects to HTTPS. See what is SSL and why HTTPS matters.
Step 8: Test everything
Check on real phones and desktop browsers: navigation, forms, images, 404 pages, and speed. See website launch checklist and how to test website speed.
Step 9: Tell search engines
Set up Search Console and submit your sitemap. See how to set up Google Search Console and how to get a new website indexed.
Step 10: Plan updates
Keep your source files backed up, and keep a record of changes. For each update, rebuild and redeploy, and test. Use a preview deployment or staging copy where available. See what is a staging site and how to keep a website changelog.
Common mistakes
- Uploading the project folder instead of the output
- Broken links that worked only on your computer
- Forgetting to test the form
- Not setting up a redirect for the other www version
A deployed site still needs care. See website maintenance checklist and website downtime: what to do.