The Internet wouldn’t work if it weren’t for Short URLs. How else would we efficiently share our funny cat videos? I’ve written a couple of blog posts on them myself. Handy little devils, aren’t they?
One downside of them is you don’t know where they’re going to lead you. That innocent looking bit.ly link could take you to some amazing bit of wisdom on the internet, sure. But short URLs can have a dark side, too. The payload waiting for you on the other side of that t.co link could also be a Rick Astley video, you just never know.
Being a generally untrusting person, I always hesitate to click URLs if I don’t know exactly where they are going. But then I started feeling like I was missing out on stuff. That’s when I put my thinking cap on and wrote this little PowerShell gem:
$url = “https://www.toddklindt.com/sp2016builds”
((Invoke-WebRequest -UseBasicParsing –Uri $url).baseresponse).ResponseUri
This little beauty will take a short URL for any of the common shorteners and tell you what it resolves to. Here it is in action.
The URL at the top is the short URL we want to check, and the circled URL below is the secret URL it’s forwarding you to. If you decide it is safe, you can type start $url in PowerShell and it will open up in your default browser.
Once again, PowerShell comes to the rescue. I hope this helps a few of you explore short URLs without fear, and without having to listen to Rick Astley, unless you want to of course.