How to Use Google Drive as Free CDN for your website (Content Delivery Network)
- First thing is you will need a Google account for this.
- Once your Google account is ready login to Google Drive via https://drive.google.com
- Then create a folder and name it as anything you want.
- Once your folder is created, Right click on the folder, there will be menu popup, Find the share settings and hit on it.
- Once you click on the share settings it will open up a another form like bellow picture. You can find small link to “Advance Settings”. Click on it..
Once you are inside you can see that “Who has access” settings is by default set to “Private – Only you can access”. Change it to “Public on web” and save it.
Now just copy your website files into that folder you created.
Then copy the folder ID from the address bar. Once you are inside the folder you created, The address in the address bar should look like bellow address
“https://drive.google.com/drive/u/0/folders/0ByGpd2QD5Q_kiWW52eV96aVNzN1E” and the folder ID is the part after “https://drive.google.com/drive/u/0/folders/”
So folder ID is 0ByGpd2QD5Q_kiWW52eV96aVNzN1E
Now your website is alive at http://googledrive.com/host/YOUR_ID_HERE. Please replace the YOUR_ID_HERE with your Folder ID. So in this case it should be http://googledrive.com/host/0ByGpd2QD5Q_kiWW52eV96aVNzN1E
Creating sub-domain for your CDN
You will need to create a sub-domain for this..
Log in to your domain control panel (e.g. Godaddy) Your Account > Domain > Your Domain > Manage Domain > All Host Records > Create a new sub-domain > Click Save (Name your subdomain as static)
Host Name: static
IP Address/URL: http://googledrive.com/host/folder-id
Record Type: URL Redirect
Now you can use this new sub-domain as your CDN URL like this http://static.domain.com/image.jpg.
If you found this article helpful, then please share it with someone else by using the buttons in the left. Thank you!