Use Dropbox with your own Web Domain
Your Dropbox account comes with a special “Public” folder that you may use to host documents, images, and other stuff that you want to share with everyone. To give you an example, I distribute the Always on Top utility only through my Dropbox Public folder – the file is always available for download and puts little strain on the server.
Personalized Dropbox URLs
All public URLs on Dropbox follow a very standard pattern as illustrated above. The first part of the URL, which reads like dl.dropbox.com/u/ID/, is common for a Dropbox user and you can easily map it to your own domain or sub-domain.
This will make your Dropbox URLs appear less complex, you get to indirectly promote your brand since its now mentioned in the download links and, best of all, you can track individual file downloads.
How to Map Dropbox to your Web Domain
Option A. If you have a domain and a host running Apache, use the following approach:
Step 1. Go to your cPanel and setup a new sub-domain (for example, files.labnol.org). This should create a new directory with the same name on your server.
Step 2. Log in to your server and create a new file called .htaccess in the above directory. Do remember to replace XYZ with your Dropbox ID.
1: <IfModule mod_rewrite.c> 2: RewriteEngine on 3: RewriteRule ^(.*)$ http://dl.dropbox.com/u/XYZ/$1 [L,QSA] 4: </IfModule>
That’s it. Now before sharing a Dropbox URL, replace dl.dropbox.com/u/ID with your web address (like files.labnol.org) and the recipients will still be able to download your files as before. Here’s a live example – files.labnol.org/tech-guides.html.
Option B. If you don’t have access to a web host, you may use Google App Engine to have custom Dropbox URLs.
Step 1: Download the source code for your new project from code.google.com and make the following changes in the code.
- Replace XYZ in mirror.py with your Dropbox user number.
- Replace APPNAME in appl.yaml with some unique name.
Step 2: Deploy the above project through the Google App Engine launcher. Refer to my previous Web Proxy tutorial for details on how to get started with GAE.
Step 3: This is optional. If you already have a web domain configured with Google Apps, you may serve your Dropbox redirection app on that domain else your Dropbox URLs will have structure like appname.appspot.com but without your Dropbox ID.[*] You may use CNAME addresses to map Dropbox URLs to any sub-domain but in that case, the mapping will only happen at the root level and thus your custom URLs will still look complex – you don’t want your URLs to look like files.labnol.org/u/123/abc.txt.