Instructions – Installing Your Own Wordpress-Based DIY TinyURL In < 1 Hour

[Note: This post contains only installation instructions minus additional rationales or explanations. For those, read the original REUS post.

I'll assume that you are familiar with FTP and have already done a standard Wordpress install before. If you're new to Wordpress, I'd recommend hiring someone to do these steps for you. They should bill you for at most 1 hour as you will see.

I may in the future include additional links to Wordpress installation/etc. tutorials.

Has been verified to work up to Wordpress 2.9.2. See the note near the bottom about automatic updates overwriting the "press-this.php" file.]

Included with each step is the expected time to complete it:

1) Buy a .us or similar domain to install it as an add-on domain with one of your existing hosting accounts. I used a http://Bluehost.com account for this, they have reasonable prices and service, but use any hosting/domain provider you would like. Note that it’s not worth getting a separate hosting account just for this engine, and an add-on domain should only cost about $8-10 per year.

Search for short, 3-4 character .us domains, as you’ll obviously want to save space. I found that there are still plenty of 3 character semi- to non-sensical domain names available with one or two numerals in the name, e.g. I picked “3on.us” for my test case.

Once purchased, install the domain in your hosting account’s domain manager as an “Add-on domain”, which should also create a new directory under your public_html directory, in my case I simply chose “3on”. This is what the process looked like in a CPanel hosting account:

— Time: 10 minutes (depending on how long you search around for a domain you like :).

2) Now download a copy of Wordpress (WP) 2.7.x, and install it on the newly created directory, so that the directory structure will read “/public_html/3on/wordpress/…” (structure shown below is how it should look in your FTP client program, obviously with your own directory name)

Go through a normal WP 2.7 install including setting up the database and editing “wp-config.php”, if you’re using Fantastico to automate this, just make sure that the install directory is the new one you want.

Make sure you select option “no search engines” during the install, as this will avoid your stats getting falsified by frequent search engine hits on your redirect/link shortening engine. The “Settings > Privacy” panel should later look as shown below, verify and if necessary adjust after the installation:

— Time: 10 minutes.

3) Upon install, log into the WP admin panel, and edit “Settings > General” as shown in the screenshot below (again obviously with your own domain name).

You’ll also need to do one more manual step to copy the “/wordpress/index.php” into the new domain’s root directory, i.e. “/3on/index.php” and change the path inside the file as described in the link right next to “Blog Address URL”:

Enter the address here if you want your blog homepage to be different from the directory you installed WordPress.

The point being that you need your blog to respond at the domain level without any further path, i.e. “http://3on.us/” and NOT “http://3on.us/blog/”, etc. which would obviously be counterproductive to our link shortening agenda.

— Time: 2 minutes.

3) Now that Wordpress is installed, go to “Settings > Permalinks”, and select “Custom Structure”, placing “/%postname%” into the field by that option. This will append your redirect “post” names directly to the domain, e.g. “http://3on.us/testlink” — Time: 1 minute.

— Time: 1 minute.

4) Download the REUS files packaged as a Wordpress Theme here:

http://businessmindhacks.com/v/redirect_engine.zip

Then extract the .zip file, and FTP upload the “redirect_engine” folder into your “…/wordpress/wp-content/themes/” directory as you would any other theme.

Activate the theme by going to “Appearance > Themes”, then selecting “Wordpress REUS” by clicking on the theme’s screenshot or link, and finally clicking “Activate Wordpress REUS” in the upper right hand corner.

— Time: 5 minutes.

5) To leverage the Wordpress “Press This” bookmarklet feature:

First, go to the “Tools > Tools” menu, and there locate the “Press This” bookmarklet link as shown. Then drag & drop it onto your Bookmarks Toolbar (in FireFox, which is the only browser I’ve tested this in, but IE should work similarly).

— Time: 1 minute.

6) Test the new bookmarklet: Simply go to any web page you would like to shorten the URL for, and then click on the bookmarklet button in your Bookmarks Toolbar (obviously that Toolbar needs to be visible):

You will see a popup as follows (and may have to give your new wordpress site permission to open pop-ups, you’ll want to do this):

Note that you will have to be logged into your Wordpress install as “admin”, else you’ll be asked to log in first. Change the “post” title at the top to your desired link name, like in the following example (the post’s “slug”, which is the actual term for the link extension in Wordpress, is created automatically; note that any uppercase letters will be converted to lowercase and any spaces turned into a hyphen (-):

Then press the “Publish” button. Done! Your shortened redirect link has been created.

Note that you can change the descriptive text in the post body textarea shown above, just make sure that you don’t accidentally delete the entire link (and thereby the underlying URL, as this is what REUS parses out for the redirect).

You will see the following output:

The “TwitterThis!” option won’t be visible to you yet until you do one more custom change to Wordpress I’ll describe in a moment, but you will already be able to copy & paste the newly created short link by right-clicking on “View Post” and selecting “Copy Link Location” (“Copy Shortcut” in IE):

Click the “View Post” link to test that your redirect actually works.

Note that you can rename the bookmarklet itself in your browser’s Bookmark Toolbar by right-clicking, selecting “Properties”, and changing the “Name” to your desired option, e.g. “MyShortLink” in case you’re using the “Press This” bookmarklet for other Wordpress blog installations or yours.

— Time: 3 minutes.

7) To enable the “TwitterThis!” option on the “Press This” result pop-up as was shown above: Locate the file “press-this.php” in the directory “/wordpress/wp-admin” and rename it to “press-this.php.old” or similar. Now go to the REUS theme directory “…/wordpress/wp-content/themes/redirect_engine” and find the “press-this.php” file there. Then copy that file into the “/wordpress/wp-admin” directory.

The newly updated custom version of “press-this.php” popup with character counter will look as follows:

In my example, we have 7 characters for “http://”, 7 for the “3on.us/” domain name plus forward slash, leaving 16 characters for the link extension (the post name as described above). Once you hit “Publish” you will see

Now when you click on “TwitterThis!”, you will bring up a pre-populated Twitter status form field on your  “twitter.com/home” page (assuming that you are already logged into Twitter, else it will prompt you to log in before passing you on):

Make any desired edits to your tweet, hit “Update” and you are done.

— Time: 3 minutes.

8) To allow for the “index.php” of your install to be redirected to the default page of your choosing (most typically this would be your own blog or site), open up the “redirect_engine/index.php” file, and place your own redirection URL at line 9:

header( “Location: http: … “);

In the case of my example install, “http://3on.us” will redirect to the original REUS post, which makes sense since it explains what REUS does. But of course for your own purposes you’ll want to point to your blog home page, or maybe even a “special offer” page, etc.

Also, any short URLs requested that are not pointing to an existing entry in REUS (“404 Not Found” HTTP error code) will redirect automatically first to the “redirect_engine/index.php” page, and from there to the location you just set.

— Time: 1 minute.

9) To install the customized WP-Shortstats solution for your REUS install:

I have included a somewhat modified version of the WP-ShortStat plugin by Markus Kaemmerer. The only changes made are some minor DB queries and results display order/selection that is more in line with the purpose of REUS. All the credit belongs to Markus and any help he may have had in creating this great/simple/functional plugin. I just adapted it to my purposes.

Simply place the “wp-shortstat.php” file included in the “/wordpress/wp-content/themes/redirect_engine/” directory into the “/wordpress/wp-content/plugins/” directory, then activate in the Wordpress Admin console under “Plugins” as normal. I am not distributing the entire plugin with Language files, etc. BTW, just the 1 core file with my modifications. This is all you need for REUS.

— Time: 3 minutes.

10) Lastly, I recommend that you either delete or rename as shown (“filename.php.off”) a number of core Wordpress files (14 as of my last count) in your REUS installation, which will avoid RSS access to your list of shortened links, as well as secure it against malicious/curious hacking attempts on certain files and the resulting annoying hits in your stats to long ULRs such as “/wordpress/wp-cron.php?2342345…….”:

NOTE: If you choose to run a Wordpress 2.7.x automatic “1 click” update that is available since 2.7, you will then need to delete or rename the aforementioned files under “/wordpress/” again, as well as re-place the “wp-admin/press-this.php” file with its custom REUS version again. The REUS theme files and the wp-shortstat.php plugin should not be affected.

— Time: 3 minutes.

Last Things: Your REUS Redirect Engine/URL Shortener is now fully installed and ready to go. Please contact me in case you have any suggestions. I am providing this Wordpress theme HACK software free of charge and make no representations or other warranties as to the fitness for your needs now or in the future.

As the REUS solution is free, I can also not provide any form of tech support, or other formal assistance relating to it. I may choose to make further customizations, or updates relating to future versions of Wordpress but cannot guarantee anything in that regard.

The mechanism is exceedingly simple, so anyone familiar with the internals of Wordpress and basic Web programming should be able to see how it works, and how to possibly adapt it to your purposes, or make adjustments for future versions of Wordpress. Wordpress Open-Source Software published under open-source licenses. Caveat emptor and all that…

Happy custom URL shortening!

- Alex Schleber