Redirect to old Reddit

Always redirects to old-Reddit, preserving the path of the original URL.

// ==UserScript==
// @name Redirect to old Reddit
// @description Always redirects to old-Reddit, preserving the path of the original URL.
// @namespace redaphid
// @version 1.0
// @license MIT
// @include *://www.reddit.com/*
// @grant none
// @run-at document-start
// ==/UserScript==

const pathnamesToExclude = ["/gallery/"];
const oldRedditUrl = "https://old.reddit.com/";

const redirect = () => {
  const currentUrl = new URL(location.href);
  const pathname = currentUrl.pathname;

  for (const pathnameToExclude of pathnamesToExclude) {
    if (pathname.startsWith(pathnameToExclude)) {
      return;
    }
  }

  const destination = new URL(pathname, oldRedditUrl);

  // Redirect the user to old-Reddit, preserving the path of the original URL.
  location.assign(destination);
}

redirect()

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址