This image be our episode 2,900-4 entitled DIY URL shortening, it is posted by Clare 2, and in about 12 minutes long, and Karina Cleanflag. The summary is, quick tip on how to shorten a URL without a silly stress. This episode of HBR is brought to you by an honest host.com. Get 15% discount on all shared hosting with the offer code HBR15, that's HBR15. Bit your web hosting that's honest and fair at an honest host.com. Hi everyone, this is Clare 2, you're listening to HBR. This episode I'm going to do a quick little short tip idea that I had, I mean it's something that you probably could think of yourself, but maybe you haven't. It's something that every time I sort of bring it out and play that card people think, wow, that's a really great idea. I never thought of that. So I figured it's probably actually worth doing an episode on, because while on one hand, I keep thinking, this is super obvious, why am I talking about this? On the other hand, it's clearly something that people enjoy when I bring it up. So what is it? Well, the thing is, we've all seen those URL shorteners, right? They used to be all the rage like five years ago. I feel like I don't see them quite as much now, but they were a big thing for a while. And you'd see them as bit.ly URL shorteners, you'd see them as I think another one was owl, Lee. I think Google probably had one. Like I said, they were kind of all the rage, it seemed like everyone had them for a while. Maybe there's still a thing on Twitter, I don't know, because you've got that character limitation. I don't really, I don't do Twitter. So I don't know what's going on in Twitter. I opt for the free and open source service, master it on. You should check it out, master it on, dot social, for more information. So anyway, you've got these URL shorteners where you have some long, ugly, horrible link. You want to make it memorable. This could be anything from, I don't know, your host record at Hacker Public Radio, where you can go into your, into the complete episode listing and Hacker Public Radio, and then click on on the host. And then you get all of the episodes recorded by that host. So that's kind of a, for instance, for me, that's kind of a good resume material. I might want to link it directly to that. If I'm pitching myself to someone as a podcaster, maybe I would say, hey, go to this link bit. Lee slash Q5LT0, and you'll see all of my, well, that's stupid, right? That's a, that's a horrible URL shortener. I mean, it does work. It's just not very memorable. It doesn't roll off the tongue. And there might be services out there. Maybe it's come to a point now where you go to your URL. You are a shortener, and they have vanity, shortening ability. So you can do bit, dot, dot, ll slash, clot to underscore HPR. I don't know. But the point being that default generally are these short URLs that are, are randomized sort of out of necessity. And you don't necessarily have any control over what they are. And certainly you don't have ownership over the thing, providing the shortened URL. So what I do, and what I've done for quite some time now, is I simply make my own. How do you make your own? It's actually a lot easier than you might think. So if you have a hosting plan at all, then you can, like, with a domain name. And, of course, you can get free, don't, don't, don't domain names at places like freenom.com, and probably other places. You can get the dot, tk or the dot ml or the dot, and gq or qg or whatever domains for zero dollars. And then you can throw them somewhere on a server. It could be your own Raspberry Pi in your living room. It could be a cheap hosting plan provided by any number of, perfectly good hosting providers, such as for instance, and honesthost.com, you should check them out. And now you have essentially a URL shortening service. How you may ask, well, it's a simple command. So first of all, what I do is I do, well, I go onto the, onto my domain, whatever it might be. In this case, I'll use gnewworldorder.info as an example. So SSH gnewworldorder.info, and then I make a directory called portal. So in the public underscore HTML or the WWW folder, whatever your hosting provider sort of, whatever convention they provide, you make a directory called portal, or if you want it really short, it could just be you, for instance, the letter you. And you know from now on that anything, gnewworldorder.info slash you, is the URL shortened version of something, and then slash, and then some keyword. So this is the shortened, this is the vanity shortened URL that you want to use. So for instance, if I am creating a, a pointer to my host identity on hacker public radio or the list of all of my episodes on hacker public radio, then I could do, you know, make a der WWW dot or slash rather you slash hpr, and that would be it, right? So that's the destination. When I send people, when I want to refer to myself as an hpr host, I'm going to send people to gnewworldorder.info slash you slash hpr. Now if I was sending them to my podcast on fantasy lore, then I might send them to gnewworldorder.info slash you slash, I don't know, fantasy or chronicles, whatever, lore, maybe that would be good, L-O-R-E, that would be good. And from there, you simply do a simple http redirect. Now the way that I do that, once again, I do it with a, with a show, I do it over SSH. So for instance, so the make directory command, by the way, would be SSH space example dot com, again, that would probably be gnewworldorder.info for me. So SSH example dot com, make der WWW slash you slash hpr or lore, or whatever shortened URL you are making. So the WWW slash you, that already always exists, that's always there, right? The slash something is the vanity URL shortened or key that you want to use. Got it? Okay, cool. So now the, the, the next command would be an SSH command again, but it would be echoing some, some, some html code into www slash you slash hpr slash index dot html. Such that when you send someone to gnewworldorder dot info slash you slash hpr by default, the web server opens any available index dot html it finds in the directory, which it does. And then it uses it detects in the, in the html, and htp redirect to whatever address I want to redirect to. What that looks like depends on how you're doing it. Again, I do this with a shell script, so I don't have to worry about all the details, but I'm going to give it to you in the, in the raw format, if you want to create a shell script that does it, then you can do that as well. So it would just be SSH space example dot com, and the next destination is your host, and then echo, space double quote, back slash double quote. So that's, that's two double quotes kind of in a row, but one is escaped, and that's very significant, because the, the first double quote is for our SSH command right now, the, the second one, the one within escape, is the one for the, is the, is for the command that's being run on the server, on the, on the example dot com. So double quote, back slash double quote, and then some tags, for instance, HTML, that's a tag. So, greater than HTML less than, greater than title less than, shortened URL, and then close the title, and then open a head tag. So greater than head less than, and then meta HTTP dash a quiv equals single quote, refresh, close single quote, space content equals single quote, zero semicolon URL equals, and then in this case, HTTP colon slash slash hacker public radio dot or slash correspondents. PHP question mark host ID equals 78, close quote, that is, close single quote, and then close self, self, self, close this meta tag, so forward slash greater than, or whatever that is, greater than, whichever one that is, and then close the head tag and then close the HTML tag, and then again, back slash double quote, to escape that, and then a double quote, to close that space, back slash, redirect, www slash portal slash, or rather www slash u slash, hpr slash index.html, and that's it. Now you have echoed the HTTP redirect into a destination file in www slash u slash hpr slash index.html, and so when someone goes to that location, it will automatically detect that there's an index.html, which will automatically detect that there's a redirect, which will take the user to your actual destination URL. It's a really simple trick, it's like I say pretty obvious, but it's one of those things that I think a lot of people don't, don't think about until, until it's done by someone else. You see it done, and then you think, oh my gosh, that's such an obvious way, obviously a better way to quote unquote shorten a URL. Because that way you've got some kind of, you've got your brand ownership or whatever, you've got your own domain that maybe you feel some affiliation with, and you've got something more memorable, because it's a word instead of a string of random letters and numbers, and you can also control how long it rains, how long it exists, and when you need to redirect it again, you can go in and adjust the HTTP redirect. So there's a lot of ownership there that you don't get otherwise. So that's my quick tip, like I say, it's pretty simple, you can do it a variety of ways. I mean, I just do it with a script after having done it with raw SSH for way too long, finally realized it was dumb, and I just do it with a script now, because I kept doing the escapes wrong. But you could write something in, I don't know, any number of languages, to make it a mere command away, and it would be fast and easy, and a lot simpler probably than using one of those weird URL shortening services. So I hope that helps, thanks for listening, and I'll talk to you next time. You've been listening to Hecker Public Radio, and Hecker Public Radio.org. We are a community podcast network that release the shows every weekday Monday through Friday. Today's show, like all our shows, was contributed by a naturebior listener like yourself. If you ever thought of recording a podcast, then click on our country begin to find out how easy it really is. Hecker Public Radio, was founded by the digital.com, and the information computer club, and it's part of the binary revolution at binref.com. If you have comments on today's show, please email the host directly. Leave a comment on the website or record a follow up episode yourself. On this otherwise status, today's show is released on the creative comments, attribution, share a like, the.olices. Share a like, the.olices.