Last active
February 21, 2024 14:22
-
-
Save msanders/52700d5c5ed76f1114594ddb862b530e to your computer and use it in GitHub Desktop.
Userscript: Old Reddit Redirect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Old Reddit Redirect | |
// @description Redirects www.reddit.com to the old version of the website | |
// @downloadURL https://gist.githubusercontent.com/msanders/52700d5c5ed76f1114594ddb862b530e/raw/old-reddit-redirect.user.js | |
// @updateURL https://gist.githubusercontent.com/msanders/52700d5c5ed76f1114594ddb862b530e/raw/old-reddit-redirect.user.js | |
// @version 2023.10.19 | |
// @run-at request | |
// ==/UserScript== | |
[ | |
{ | |
"id": 1, | |
"action": { "type": "allow" }, | |
"condition": { "regexFilter": "^https?://www\\.reddit\\.com/media\\?", "resourceTypes": ["main_frame"] } | |
}, | |
{ | |
"id": 2, | |
"action": { "type": "allow" }, | |
"condition": { "regexFilter": "^https?://www\\.reddit\\.com/gallery/", "resourceTypes": ["main_frame"] } | |
}, | |
{ | |
"id": 3, | |
"action": { "type": "allow" }, | |
"condition": { "regexFilter": "^https?://www\\.reddit\\.com/settings/", "resourceTypes": ["main_frame"] } | |
}, | |
{ | |
"id": 4, | |
"action": { "type": "allow" }, | |
"condition": { "regexFilter": "^https?://www\\.reddit\\.com/r/\\w+/s/", "resourceTypes": ["main_frame"] } | |
}, | |
{ | |
"id": 5, | |
"action": { | |
"type": "redirect", | |
"redirect": { | |
"transform": { "scheme": "https", "host": "old.reddit.com" } | |
} | |
}, | |
"condition": { "regexFilter": "^https?://www\\.reddit\\.com/", "resourceTypes": ["main_frame"] } | |
} | |
] |
how do you install it though ?
To install, open the raw link and follow the prompt on the Userscripts extension modal. Alternatively, you can create a new JavaScript item on the extension page and copy/paste the script. On iOS, go to the same link and tap the puzzle icon in the address bar and then the “Userscripts” menu item. Instructions to install the Userscripts extension can be found here.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Compatible with Userscripts for Safari, documentation on
declarativeNetRequest
available here.Equivalent rule for Redirector extension:
Reddit redirect
https://www.reddit.com/example
^https?://www\.reddit\.com(?!/(?:(?:media|gallery|settings)\b|r/\w+/s/))([/#?].*)?$
https://old.reddit.com$1
Both of these methods are faster than using
window.location.replace
in Greasemonkey, which requires an additional network request even with@run-at document-start
.