How to Host Websites on Google Drive

When you need to whip up a quick website, maybe to show to a client or make an example, there are a few options. You can already host websites on Dropbox, Amazon S3 and Google App Engine, even though these services were not meant to be used as a publishing platform. Last week Google announced that it is now possible to host HTML/CSS websites on Google Drive as well. Google Drive site publishing also supports JavaScript, so it’s even possible to run a JavaScript Drive app directly from Drive. This short tutorial will show you how to host a simple website on Google Drive.

1. Go to https://drive.google.com and create a new folder. To do this click on the big red “Create” button and from the dropdown menu click on “Folder”.

google-drive-publish-1

2. Name you folder. It doesn’t matter what name you use because the name will not appear in the URL of the website.

3. Right click on the newly created folder, and from the context menu click on Share > Share. You can access this same menu from the “More” button at the top of your Google Drive page, once your folder is selected.

google-drive-publish-2

4. This will open the Share settings page, with a link to the shared folder. Copy this link to your clipboard.

google-drive-publish-3

The folder is currently private. You will have to make this public if you want to host a website accessible to all. Click on the “Change” link as shown above.

5. On the next pop-up window, choose the desired option. I’ve chosen “Public on the web” but you can also choose “Anyone with the link” if you wish to share the website only with a selected group of people. Be aware, that anyone can view this website if they have the link and no Google sign-in will be required.

google-drive-publish-4

6. Open your folder, and upload the contents of your website – HTML pages, CSS files, images and JavaScript.

Remember the share URL you copied to the clipboard? Oh, you didn’t. Don’t worry, you can return back to the drive listing and get the URL again from the Share context menu item.

The share URL looks like this: https://docs.google.com/folder/d/0B2TgmhltmR2FVZnN5aGttQU0/edit

The part highlighted in bold is the ID of the folder. You take that ID and turn it into this:

https://googledrive.com/host/0B2TgmhltmR2FVZnN5aGttQU0

That’s the URL to your website. Granted, it doesn’t look pretty and there is no way to add a custom domain to it, but you can always use a short URL service to shrink the URL.

You will need to have an index.html file in the folder for the website to display properly, otherwise Google will simply display a list of files in the folder.

To see Google Drive site publishing in action, check out this example site served from Google Drive at https://googledrive.com/host/0B716ywBKT84AcHZfMWgtNk5aeXM.

This Article Has 11 Comments
  1. Kukuh Basuki Reply

    Cool!

  2. Addatoday Reply

    Great!

  3. niu tech Reply

    And you can shorten these URLs using gdriv.es!

  4. Kaushik Patowary Reply

    Those gdriv.es URL would look great!

  5. Anonymous Reply

    Nice post. Trying some stuff with it.
    One question : how do you link files inside your html like css files or images ?

    Thanks

  6. Kaushik Patowary Reply

    To link files use relative URL such as /images/picture.jpg

  7. Unknown Reply

    i do not seem to get this working
    i use google chrome
    made a very simple index.html file
    when i go to the webadress ,internet gives me the file but nothing is published

  8. Kaushik Patowary Reply

    What's the address?

  9. Kaushik Patowary Reply

    You seem to have nothing on the url. Google shows a blank folder.

  10. Unknown Reply

    When i open in google chrome it gives the folder but not the simple index.html i putted in the folder

Leave a Reply

Your email address will not be published. Required fields are marked *