Author Options:

Easy-to-remember names! Answered

Ever wanted to share your instructable with someone offline? Its hard to remember those random ID's at the end of the URL, isn't it?

(Note, you can be afraid of me, if you'd like)

Anyway, on to the point.
Look at the URL! Its all nice-looking! And what do you know, I added the Allsteps link in for you!

You probably want this for yourself, dontcha? Don't worry! Just type this in the URL of your favorite browser!


The "slug" is the thing that goes on the end of the URL, in the above case, it was "biobattery". It can be numbers or letters, but it is case-sensitive!

The instructable ID should be JUST that random string. No slashes, no ?ALLSTEPS, just the random letters/numbers.

Please, please don't abuse this, please. If I find that someones been taking up multiple slugs for an instructable, or not linking to an instructable, you're going to be sorry ;-)

All of you who say I should being doing something else, this was done in less than fifteen lines of python! Thats why theres no nice page to create those links, because I'd have to spend 10 minutes making it. I actually spent more time on this post than getting it to work!

And if anyone wants to donate a nicer domain, just ping the above domain to get my IP, and let us know ;-)

PS: If you hate "instructables.thruhere.net", you can use "ytm.ath.cx", if you can remember it! Its pointed at the same server.



10 years ago

So, when are you coming to intern at Instructables?

I could come down for a week right now if you wanted!

School first! ;D We'll talk.

Well, I think it could kinda-sorta-maybe-stretchit be almost school... I'd learn better things at least...

Fine... :P

Oh, a quick question, how do you guys define "featured"? If its by HTTP referrer, I don't want to make it so that whenever someone hits one of these links it becomes featured.

The featured setting is in the database. Your system is fine.

I love stuff like this. This is something I've wanted for a while. Human-readable URLs are so good for so many reasons. We've just had too many other things ahead of it in the pipeline. Now that Rachel isn't sleeping though...

What languages do you have on your server? I know this is done in Java, of which I have limited knowledge of making web sites from. I did this in Python, but I could redo it in something else, like PHP, if need be.

By the way, if its not working, sorry. This is a server thats running in our basement, and right now we're having some internet issues.

Wow, this is cool. I assume you got appropriate permissions? :P

. What is he doing that he would he need permission for? . As far as I can tell, he is using his own server. Thruhere.net appears to be a dynamic DNS service, so instructables.thruhere.net probably points to his IP. . All he is doing is redirecting. His server takes the "legible" URL, looks up the "real" URL, and then sends you on your way (guessing, but would make a small bet I'm right). Check out your address bar when you use it - you still end up at Instrucable's site with that goofy URL. . Using "instructables" in his domain name may be an intellectual property problem, but, even if the Instructables ppl don't like it, I can't imagine them doing much more than sending him a note saying "please stop," which he appears to be eager to do already. . As far as I can tell, the worst thing he can do is log who's IP is looking at which pages. If I use his service, I give him permission to log my access and use the info any way he sees fit (as if he needs it).

But once I know everyone's IP, I CAN RULE THE WORLD!!!! Or something like that... And yeah, you're exactly right. All it does is look up the DB the name you set, and redirects you to the external one. I'm not doing any extra logging (right now, at least) than what is the default. I know Apache keeps some logs, and I think Django does too...

. If you don't mind sharing the source code, I'd be curious as to exactly how you did it. I've thought about doing something similar, only with multi sites and without public access. I have a file server that isn't working very hard and would make a great "URL translator." . PS: DynDNS rules (finally figured out they are behind thruhere). Been using them since it was "donation please." I made a small donation (5 or 10$US), and when they went "commercial," they grandfathered me with all but the top-tier services.

The code is spread through out 4 files. But I'll share it anyway.
If you want a nice URL parser, look into the Django framework. Its in python, so you'll have to learn another language, but its worth it. You know how everyone loves Ruby On Rails? Its like that, except everyone whos tried both likes Django better :P

from django.db import modelsclass Link(models.Model):    external = models.CharField(maxlength=40)    name = models.CharField(maxlength=30)    class Admin:        pass    def __str__(self):        return self.name + " -- " + self.external

from django.http import HttpResponsePermanentRedirect, HttpResponsefrom models import *def redirect(request, name):    id = Link.objects.filter(name=name)[0].external    return HttpResponsePermanentRedirect("https://www.instructables.com/id/"+id+"/?ALLSTEPS")    def addRedir(request, name, id):    check = Link.objects.filter(name=name).count()    if check == 0:        l = Link(name=name, external=id)        l.save()        return HttpResponse("Added!<br/> NOTE: Don&apos;t use this for anything important, I am not liable for my server being down or your unability to access the instructable.<br/>Do not abuse this system, or there will be consequences.<br/>This is a BETA product.")    else:        return HttpResponse("Sorry, that name is already taken!")
These were an app called "ibles", and I didn't make a separate urls.py just for it; so my urls.py looked like this. If you called it foo, just replace ibles with foo:
from django.conf.urls.defaults import *from forum.ibles.views import redirect, addRedirurlpatterns = patterns(&apos;&apos;,     (r&apos;^id/(?P<name>[A-Za-z0-9-_]+)/$&apos;, redirect),     (r&apos;^id/add/name/(?P<name>[A-Za-z0-9-_]+)/id/(?P<id>[A-Za-z0-9-_]+)/$&apos;, addRedir),#Other URL patterns go here)

All you need to know to understand this is that models.py defines the database, and that views.py defines how the pages render.

Permissions... uhh....
(I know!)
Well, its always better to beg for forgiveness than to ask for permission..?

If any instructablonians come by, you guys don't mind, right?


10 years ago

Awesome! I got it to work and added my first instructable. But I'm not sharing the link yet, because I want my first instructable to be pristine, and perfect, so I don't need to add one of those dumb "Please be nice!" things.

You still have a bizzare ID string to deal with. Its smaller, but still random.

Why not iBle'ise it?

I will when I get time, maybe in a week or so ;-) This is very-betaish. I'm defiantly going to work on it, its just in an early stage. If anyone wants to donate, a domain of your choosing would be nice. (You can get 'em for $2 at yahoo!)

Why not just get yourself a .tk address for free?

2 reasons: .tk is forwarding. .tk's are add ridden. With the forwarding, the .tk banner will stay with you even once you go to instructables. The second is obvious... :P I find them a pain in general. I'll stick to this if you don't mind :P

I used to have that problem, until i installed ABP to block the banner (The frame still showed though) and blocked JS from it to stop the popup.

Yeah... I don't like ABP. And yeah, not everyone has it.

Nah it shouldn't be a problem I ~~hope~~ think... By the way, your example link stopped working at my end. ( The URL is still the letters and numbers, nothing else)

Sorry, I was playing around to make it easy to "Moderate" on my end. Should be fine now.