CodeWithAavi › Blog › Host a static website free on Vercel
A static site (plain HTML, CSS and JavaScript) is the easiest kind of website to put online. This guide walks through publishing one on Vercel from a GitHub repository, connecting your own domain, and using vercel.json for clean URLs and redirects. It also covers the mistakes we made while running ShayariGarden on Vercel, so you can skip them.
Updated: October 2026
index.html file (and your CSS, JavaScript and images).Open a terminal in your project folder and run:
git init git add . git commit -m "First version of my website" git branch -M main git remote add origin https://github.com/YOUR-USERNAME/YOUR-REPO.git git push -u origin main
Create the empty repository on GitHub first (the green New button), then paste its URL in the git remote add line.
your-project.vercel.app.From now on, every git push to the main branch publishes a new version automatically. Other branches get their own preview links, which is handy for testing changes.
www.example.com).CNAME record for www.Choose one version as the main address, either example.com or www.example.com, and let the other redirect to it. Search engines should see a single address for each page.
Create a file named vercel.json in your project root. This example removes .html from addresses and permanently redirects an old address to a new one:
{
"cleanUrls": true,
"trailingSlash": false,
"redirects": [
{
"source": "/old-page",
"destination": "/new-page",
"permanent": true
}
]
}
permanent: true sends a permanent (308) redirect, which tells search engines to move the old address's ranking to the new one. Use false for a temporary redirect.
npm install -g vercel vercel # creates a preview deployment vercel --prod # publishes to your production domain
The first run asks you to log in and link the folder to a project. After that the two commands above are all you need.
/Shayaries/ and /shayaries/ are different addresses. A link that works on your Windows or Mac computer can return a 404 online. Keep one spelling and use it everywhere.vercel.json (about 90 of them) instead of wildcard rules./coding/styles.css instead of ../styles.css. Relative paths break when the same page is reached through a different folder depth.Disallow line can stop search engines from following your redirects.https:// and the other domain version redirects to your main one.sitemap.xml in Google Search Console.Vercel offers a free Hobby plan that can host static sites with HTTPS and automatic deployments from GitHub. The Hobby plan is meant for personal, non-commercial use, so read Vercel's current terms and pricing before using it for a site that earns money.
You only need a folder of HTML files, a GitHub account and about ten minutes. The steps above need Git for the first upload; after that, publishing a change is a single push.
Add "cleanUrls": true to a vercel.json file in your project root. Then /about.html is served at /about, and Vercel redirects the old .html address to the clean one.
The most common cause is letter case. Vercel's servers treat /Folder/ and /folder/ as different paths, and your local computer may not. Make the link, folder and file names match exactly.
DNS changes often take a few minutes but can take several hours. Vercel shows the domain as valid once the records are found and then issues the HTTPS certificate automatically.