Pages

Monday, January 21, 2013

8

How to easily host web content on Google Drive

This article is deprecated, here's a message from Google:

Hello from Google,

We announced last year that we’re deprecating web hosting in Google Drive for users and developers. Our records show that you might have used this feature to publish a webpage or serve other web assets.

On Aug 31, 2016, we will discontinue serving content via googledrive.com/host/[id] and the webpages will not be accessible anymore.

As an alternative to web hosting in Drive, we recommend:

  • Blogger—An easy and free way to host websites.
  • Firebase Hosting— An alternative if you’re using the web-hosting feature to serve static webpages with items on Drive.

If you have additional questions or need assistance, please contact Google Support.

Sincerely,

The Google Apps Team




Last November (2012) Google announced that Google Drive can now host static web content, for example html pages, javascript files, and flash. Here's the article where they announced this: Announcing Google Drive Site Publishing, and here's the documentation: Google Drive SDK.

It all looks very good, you can programmatically make shared public folder for hosting and add content. But what if I just wanted to host some .js (javascript) files which I have ready? Must I write a program to implement this hosting? Fortunately, I don't.

Hosting web files on Google Drive

First you have to create a directory in your drive. It can be a subdirectory (of a non-shared directory), for example in the root I have sub directory "Web Hosting" (private dir) which has all the public web hosting directories I have made.

/Web Hosting
--/Google Drive hosting url tool
--/Some Other Web Project
--/etc...

After you have created the directory, you can upload files there. When you want to begin hosting those files, select "Share..." for the directory, and under "Who has access" change the directory to be public on the web. Copy the "Link to share" url from the sharing dialog.


To get the web hosting url, use this tool ("Google Drive hosting url tool" hosted under my Google Drive):



You can make the url manually, or use the Drive API and "webViewLink", but I made this simple javascript tool for the job. It is a hosting example at the same time.

Other options for web hosting with Google products

You can also use Google Sites to host your files. Google App Engine can be used, too, but that is a bit more compilicated.

Some tips for hosting on Google Drive

  • Don't upload multiple files with same name (like two copies of index.html) under the same directory. Use the "Manage revisions" option.
  • You can use subdirectories under your web hosting directories.
  • Do you have a good tip for Google Drive hosting? Please post it as a comment.

Thanks to Ben for the article idea. :)

Update May 6th 2013:
Updated the tool to handle the new Google Drive sharing urls.
[Hide comments] - [Show comments]
Click on a single comment to hide/show its text

8 comments:

Ismaïl SOSSÉ ALAOUI said... [reply]

a really precious post
thanks for it.

niu tech said... [reply]

Don't forget that you can get a custom alias for you Google Drive website on GDriv.es!

MS-potilas said... [reply]

@niu tech
Wow, that is great, thanks!

Ben Benjabutr said... [reply]

Wow! you care so much about your readers! Thank you very very much!

Web Hosting India said... [reply]

I know we can host website at Google driver but did not knew how to make it possible. Thanks for a great article, solved my problem.

lekitra said... [reply]

what? Gdrive or Google Sites as an hosting web? i'm not using both of them.. that's not same with Web Hosting. On Gdrive or Gsites, you will not get script EDITOR. so how? download the script file, edit it, then upload it again. copy the new URL, add it/replace it into the blog.

so that's makes me using Free webhost like 000webhost, etc. why? just edit online any script file on the ftp. and script updated..

topspot-official said... [reply]

Hence, Google Drive is the best option you have for hosting your static website. :)

Post a Comment

Related Posts Plugin for WordPress, Blogger...
See the hack
for this dynamic
views icon: