This very website is a static site: plain HTML, CSS and images, served directly to your browser. Static hosting is one of the biggest improvements in web hosting of the past decade. Read static site or WordPress? for the comparison; this page is about where and how to host one.
How it works
A static host stores your files and delivers them from servers around the world (a CDN). There is no database or PHP to run, so there is little to break, attack or update.
Options
| Option | Good for |
|---|---|
| Static hosting platforms with Git integration | Developers, automatic deploys on every change |
| CDN providers with static asset hosting | Speed worldwide, redirects and headers via simple files |
| Regular shared hosting | Static files work on any web host too |
| Code repository pages | Documentation and personal projects |
Deploying
- Create a project and connect a Git repository, or upload a folder.
- Set the build command if you use a static site generator, or none for plain HTML.
- Add your custom domain and update your DNS records.
- HTTPS is usually activated automatically (see HTTPS).
Redirects and headers
Most static hosts read a redirects file and a headers file from your project. That is how you keep old URLs working after a migration (see moving without losing rankings) and set security headers such as a Content Security Policy.
Adding dynamic features
- Forms: form services or serverless functions.
- Search: a pre-built JavaScript search index, like the search on this site.
- Comments: external comment systems, or simply email.
- Shop: embedded buy buttons from a payment provider.
Frequently asked questions
Is static hosting really free?
Many static hosting platforms and CDNs have free tiers with generous limits for small sites. Paid plans add features such as team access, more build minutes or advanced analytics.
Can a static site have a contact form?
Yes, through a form service, a serverless function, or the form feature some static hosts include.