Generating a url to redirect to a random site
April 10, 2023 8:30 PM   Subscribe

Is there some kind of online tool that will allow me to enter some number of links and it will generate a single url that will redirect to a random link from among the ones I entered? If not, is there some way that I can achieve this at a domain that I own? Ideally, I would prefer a solution that isn't self-hosted, but if this is the only way, then any help would be appreciated.
posted by NoneOfTheAbove to Computers & Internet (5 answers total) 1 user marked this as a favorite
 
I Googled a bit and found autorandomredirect.com which gets you most of the way there. You can enter your target URLs to generate a link that redirects to one of them at random, and then (if you want) use another link shortening service to redirect to that URL.

The main downside seems to be that the redirect happens on the client side, so the redirect page briefly flashes on the screen before loading the target page. (And, of course, there's the potential privacy concern of sending user traffic through a site that you don't control.)

If you need the redirect URL to be on your own domain, then the options depend on what you mean by "self-hosted". I'm not aware of any turnkey service that does this extremely specific thing and will let you bring your own domain. But you could, for instance, point your domain to a static S3 bucket, and set that bucket to return a redirect header which then goes to autorandomredirect.com/(whatever). That requires a bit of initial setup on your part, but I wouldn't call it "self-hosted".
posted by teraflop at 8:43 PM on April 10, 2023 [1 favorite]


I made a website a few years ago that did this. My idea was that I’d create a couple hundred pages with poems or short stories from Project Gutenberg and when I went to the main index.html URL, it would use a random number generator to pick one of those pages, automatically redirect, and then I’d have something to read without having to think about what I wanted to read. I know I don’t have the code anymore, but I also remember that it was JavaScript, so if I can find an old version of it somewhere (I think I ran it on Dropbox when that was a thing) I could probably get it from viewing the page source. And it is code, not a UI where you just enter the links, but I remember it was really easy to use, because this would’ve been right around the time I started learning to code and I didn’t know much about what I was doing.
posted by kevinbelt at 2:03 AM on April 11, 2023


Mod note: Comment removed. OP is asking how to do something, so if anyone knows of a way to do the thing, please explain, rather than writing that it would be "trivial" thing to do, thanks.
posted by Brandon Blatcher (staff) at 8:13 AM on April 11, 2023 [1 favorite]


I did find the code from my old site. I'll Memail it to you.
posted by kevinbelt at 8:39 AM on April 11, 2023


NimbleLinks, give it a list of URLs, it'll distribute that evenly, or randomly, your choice. If your traffic is light, the service is free. They have a ton of other redirection choices, such as by device, by OS, by country, and so on.
posted by kschang at 12:19 PM on April 12, 2023 [1 favorite]


« Older ISO The kids big book of /Encyclopedia of/Amazing...   |   Resources For Mental Health Services for LGBTQ+... Newer »
This thread is closed to new comments.