DEV Community

Cover image for How to Use Google Drive to Host Your Website
Matin Mollapur
Matin Mollapur

Posted on

How to Use Google Drive to Host Your Website

Google Drive is not just for storing files - you can also use it to host simple static websites for free! In this article, we'll see how to deploy and share a website using Google Drive.

Why Use Google Drive for Hosting?

Here are some benefits of using Google Drive for hosting:

  • It's completely free.
  • Files are synced and have high availability.
  • Websites are automatically HTTPS enabled.
  • Easy to deploy updates by overwriting files.
  • Quick setup with no server configuration needed.

Of course, there are limitations too. Google Drive has lower uptime guarantees compared to full-fledged hosting services. The free usage has bandwidth limits, so it's best for low traffic sites. Complex websites with server-side code are not supported.

Overall, it's a simple option for hosting small static sites or as a proof-of-concept before investing in paid hosting.

Step 1 - Create a Public Folder

First, create a new public folder in Google Drive that will contain the website files:

  1. Login to Google Drive and click New > Folder.

  2. Name the folder (e.g. "my-website").

  3. Right click on the folder > Share

  4. In the dialog box that appears, change the access to "Public on the web" and click "Save".

  5. Grab the URL next to "Link to share." This will be your website URL.

Step 2 - Add your Website Files

Now, put your website files like HTML, CSS, Javascript, images etc in this folder.

For example, your folder could contain:

  • index.html
  • style.css
  • app.js
  • images/logo.png

Make sure your main HTML file is named index.html - this will be loaded when people visit the website URL.

Step 3 - Customize Domain (Optional)

The Google Drive public URL tends to be long and cryptic. You can optionally set up a custom domain for more branding.

Some options for custom domains:

  • Subdomain: Use a subdomain on a domain you own to point to the Google Drive URL.

  • Forwarding: Forward or mask a domain to the Drive URL using services like netlify.

  • Google Sites: Use Google Sites to get a sites.google.com domain for free.

And that's it! Your website should now be live and accessible to anyone on the web. Keep adding more content and make changes by overwriting the public folder.

While basic, Google Drive hosting is a neat way to quickly launch sites as a proof-of-concept or for sharing with a limited audience. With custom domains and regular updates, you can even run production websites.

Top comments (9)

Collapse
 
robinamirbahar profile image
Robina

Interesting

Collapse
 
rcmisk profile image
rcmisk

very interesting

Collapse
 
matinmollapur0101 profile image
Matin Mollapur

Glad you like it!

Collapse
 
roger_kaplan_2f812575dc97 profile image
Roger Kaplan

The "website link" just takes you to the Google Drive directory page, it doesn't "load" index.html into the browser

Collapse
 
oldsnakenewtrik profile image
oldsnakenewtrik

this doesn't work for me when i append index.html to the drive folder url it returns 400 error

Collapse
 
chahat_rajput_f391895c2ea profile image
Chahat Rajput

drv.tw site is not responding unable to host my website

Collapse
 
happy_marshmallow_6e6450b profile image
Happy Marshmallow

This is BS. Can't believe DEV just let such BS articles be published.

Collapse
 
hmaqbl profile image
HMQBL

No it didnt worked for my food blog

Collapse
 
nwakonobi_chinedu_70296df profile image
Nwakonobi Chinedu

Tnks i'll try it out