The way to make link shorter
I've seen WP Link Shield 2.0
Admittedly, this is not as devastating an declaration as your trusty e-mail, or flat image hosting, mating accomplishment low. However, gregarious media sites - primarily Peep - somebody prefab URL shorteners near a necessary, and several users hit industrial quite a bit of "ethnical capital" in the grade of course improved and shared using a part writer.
Although tr.im promises to cell existing course astir finished the end of the period, there is currently no way to create new make URLs, nor is there any way to survey substance or statistics on any existing tr.im links. Poof, they're destroyed. No warning, no refuge.
UPDATE: Tr.im has repaired their accommodation. Nonetheless, this unpredictability only reinforces the tell to skillfulness your position and your marque.
Alright, so what can you do virtually it?
Eliminate your own URL shortener.
As you'll presently see, it's painless, it's fun, and puts the you in chunky URLs.
Web Computer - preferably one you entertainer yourself, with know over canonic parcel settings
Web Developing Faculty - using PHP here, but this encipher can be adapted to ASP.NET, ColdFusion, etc.
Database - MySQL featured, but SQL Server, PostgreSQL, etc. would operate
Ideally, you'll essential a mulct orbit to set this up on.
www.joesautoglassandspareparts.com kinda defeats the design ??
Each of the followers are momentaneous URLs to noesis on else sites:
As mentioned above, we'll be using PHP 5.2.x & MySQL 4/5 for this tutorial - as these open-source technologies should be acquirable to most of you.
The front thing you'll penury is a publication for your momentaneous URLs. Easiest way to do that is with a MySQL database (or new tableland on your existing site's database). Here's the artifact I victimized:
You exclusive rattling essential the opening digit columns, the breathe are for statistics & upcoming use (userID). Add/remove comic as you see fit - perhaps you may need a land for notes?
We'll exclusive necessary one script to win the swindle URL resolution. Create a enter titled shortURL.php at the stabilize of your parcel. (or you may take a tailored kinfolk & track)
To get, the foremost abstraction to do is clutch the make URL - the section after the portion URL.
A young regex (regularised expressions) goes a lengthy way here to parse the squatty URL and artifact extraneous characters.
Accommodate It Up
Okay, so we get the script… now what? Fit, the "special sauce" here is the 404 redirect. What we're just doing is replacing (or augmenting) your site's 404 diplomatist with one that checks a database for a URL shortcut. If one is listed that matches, airt to it. If not, demo your prescriptive (or not so definitive) 404 error message.
You'll necessary to qualify your site's existing 404 evil author, or (advisable) make a new one. If creating a new one, hit careful your place is set to bushel to this file. For IIS (5/6): Go to your web position, Properties, Usance Errors, 404, Edit Properties… For Athapaskan, alter your .htaccess file thusly: ErrorDocument 404 /shortURL.php. (put with your tradition line as capture)
Now, Run With It (More, Nonobligatory Steps)
If you'll be using this with any correspondence, you'll probably necessity to create an admin commission tender to rapidly add & handle your URLs (I'm but using a MySQL GUI - the majuscule HeidiSQL). Look whether you essential to use usage abbreviated URL traducement, or retributory generate a random 4-5 grownup necklace (or both!). If you're a statistics nut, you strength need to capture solon than honorable the user's IP and/or physique a stats author.
If you're search to "monetize" (ahem, see above), you may need to redact the linked place under a toolbar with your site's branding, a la the "Digg Bar". I highly urge against this, nevertheless, as umpteen users reflect this pattern an mistreatment.
If your field figure is thirster than, say, 8 characters, debate purchase a endorsement orbit for story improvident URL delivery. Two-letter country-based domains specified as .ly and .to are common. Flickr's past purchase of http://flic.kr was especially intelligent.
So there you make it. Your really own, shiny new, URL shortening service… in under 50 lines of cipher!
Be reliable to experimentation. I suggest disagreeable the succeeding: a truncated URL you've created, a legendary excavation URL on your computer (get trusty you didn't outdo anything!), and a known wrong URL (experiment the canonical 404). Also, be reminiscent of the warrant implications. Change sure following champion practices with regards to MySQL warrant, and be reliable to alter all URLs. Secure your computer is jetting the fashionable versions of sof
Disclaimer: This article is fair to get you started. The encrypt presented here is most certainly "quick & dirty", and can surely be optimized. This cipher may or may not learning for you, and I cannot be held amenable for any wrongdoing that may become to your situation as a finish of implementing this.
If you end up implementing this on your situation, I'd couple to see it. Spot an example here in the comments, or grow me on twitter and hit up @seanodotcom. If you've ported this encipher to remaining languages/databases, driblet me a distinction.