Google Drive as a CDN

, 2 min read

When linking a publicly shared Google Drive folder or file, people are always forwarded to the Google Drive page, instead of the actual file. This makes it difficult to use Google Drive to host downloads or static blog-content. However, Google's introduction of Google Drive Site publishing made it possible to link directly to the resource, instead of the Google Drive page.

Google Drive setup

The first thing you want to do, is go to and setup a public folder somewhere. To make this folder public, change the visibility settings to Public on the web and make sure that you are the only one that can edit.

Sharing settings

Now you will need to obtain the folder ID. Change to your public folder and you will see the ID in the address bar. The last part is the FolderID you are looking for:


The next step makes it a little bit more difficult than using Dropbox since this bit of information is quite hidden. According to the Google Drive SDK documentation, we can use an URL like[FolderID]/path/to/file.type to link directly to publicly shared files.

Here's an example with the image from above:

Namecheap domain setup

If you prefer a shorter URL to your content, you can setup a redirect from a sub-domain to your public Google Drive folder. Since my domain is managed by Namecheap, I will illustrate the process with their service. It should be similar for other services.

Go to Account -> Your Domains and select the domain where you want to setup URL forwarding. Then go to All Host Records.

Here you setup the URL Redirect to the Google Drive URL from above:[FolderID]/

Namecheap setup

Now you can use to link to your static blog content.


Philipp Hansch

Full Stack Developer

Philipp is a full stack developer currently heavily involved with Rust. Most notably he's a member of the Clippy team where he helps with bugfixing and documentation. You can follow him on Mastodon and find him on GitHub as well as Patreon.