1 / 3
Caption Text
2 / 3
Caption Two
3 / 3
Caption Three margin testing

Wednesday, June 30, 2010

“Tinyurl”-ify DropBox Public Links With .htaccess

http://ubuntu-tutorials.com/tag/dropbox/
November 8th, 2008

I just recently started using DropBox on Ubuntu 8.10 "Intrepid Ibex" and leftyfb in IRC pointed out to me a nifty little trick with .htaccess files. If you've been using DropBox I'm sure you've seen or made use of the Public folder and sharing files. You may have also noticed that the DropBox Public links are long and likely hard to remember when needed.

One thing that you can do, if you have your own web server, is dynamically generate these public links. For example:

Original DropBox Public URL:

http://dl.getdropbox.com/u/312414/Christer_Edwards.asc

DropBox Public URL with .htaccess trick:

http://zelut.org/dropbox/Christer_Edwards.asc

In order to accomplish this you'll need access to a webserver and the ability to create and use a .htaccess file. On my webserver I created a folder called "dropbox" and then pasted the following into a new file, .htaccess:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ http://dl.getdropbox.com/u/012345/$1 [L,QSA]

You will need to replace the "012345″ with your unique ID. As you notice from the original link above, my unique ID is "312414″. You can find yours by copying the public link within Nautilus.

Once this is done you can share files by placing them into your DropBox Public folder and then appending the filename to your webserver URL + created folder. Again, since I created the folder "dropbox" on http://zelut.org/, my url is http://zelut.org/dropbox/. I simply append the filename I want to share and its done!

If anyone can suggest a way to present this URL with an index.html that may be a cool trick.

No comments:

Post a Comment

Featured Post

Windows和Ubuntu双系统完全独立的安装方法

http://www.ubuntuhome.com/windows-and-ubuntu-install.html  | Ubuntu Home Posted by Snow on 2012/06/25 安装Windows和Ubuntu双系统时,很多人喜欢先安装windows,然...