Redirect9.Com

Redirection: DIY URL Shortener

How to build or buy a simple personal URL shortener.

To the rescue: .htaccess

I bought a simple URL shortener program for $15 (Linkity) and immediately ran into a big problem: the redirections were much too slow. Same with a very simple PHP script that I found on the internet which consisted of only 10 lines of code. Come on. Why is this so hard? In the case of the simple PHP script, the header() function was unacceptablely slow even followed by die() or exit(). The probable cause was my lousy PHP service by my webhosting company. Every PHP program just crawls.

Note: This pretty much pushed me over the edge. I just moved to a VPS where my PHP is lightening fast. Unfortunately, a VPS is a pain to set up.

The input is simple for that super-short PHP script. Just manually edit the Links.ini file:

Make up a simple code on the left for the link on the right. If your PHP actually works, unlike mine, this is going to work great. Just put the code in a folder, say /to/. Usage works like this: https://redirect9.com/to/np.

I now have four URL shortener programs for redirection that you can either download directly or buy:

   1. The simple PHP script above  - here.
   2. Linkity - here. Order - here.
   3. Using .htaccess with redirect rule (fastest) - here .
   4. Using .htaccess with rewrite rule - here .

In #3 and #4 you are editing the .htaccess file directly. No PHP is involved. Both are real fast. The rewrite rule version is slower because it has RegEx capability which we don't need.