[Userscript] Simple 404 Community not found straight to local search
![](https://yiffit.net/pictrs/image/87368ae4-e6fd-4686-8d26-c540937c3e31.png)
This userscript is incredibly useful in helping you populate your instance with remote communities.
Whenever you click on a link that gives you a 404 because your instance does not know about a community yet, it will immediately reload your browser and search for it, fetching you that community and making it discoverable for the rest of the users.
This works extremely well with lemmyverse.net when you click on the "home" icon in the communities tab and set your home instance.
cross-posted from: https://reddthat.com/post/69331
If you try to access a community on your local instance and it gives you a 404, this automatically takes you to your local instance's search instead and puts the community in for you.
Recommended to use with https://sh.itjust.works/post/33762](local instance redirect script) by @soy@lemmy.world
I started using Tampermonkey today, so dunno if this works with GreaseMonkey, but I assume it does.
// ==UserScript== // @name Lemmings Redirect // @version 1.0 // @description Redirect to your local Lemmy instance // @author @reddthat.com/u/Fanghole // @match https://*/c/*@* // @icon https://join-lemmy.org/static/assets/icons/favicon.svg // ==/UserScript== var unknownLemmy = document.body.textContent === "404: couldnt_find_community"; if (unknownLemmy) { // Get URL info var splitUrl = location.href.split("/"); var split2 = splitUrl[4].split("@"); var instanceUrl = split2[1]; var community = split2[0]; var searchUrl = "https://" + splitUrl[2] + "/search/q/!" + community + "%40" + instanceUrl + "/type/All/sort/TopAll/listing_type/All/community_id/0/creator_id/0/page/1"; window.location.replace(searchUrl); }