Redirect Imgur to Rimgo (via Farside)

Redirect all Imgur pages and direct media to farside.link/rimgo, preserving path/query/hash.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

// ==UserScript==
// @name         Redirect Imgur to Rimgo (via Farside)
// @description  Redirect all Imgur pages and direct media to farside.link/rimgo, preserving path/query/hash.
// @version      1.0.1
// @namespace    https://greasyfork.org/users/944996
// @icon         https://www.google.com/s2/favicons?sz=64&domain=imgur.com
// @match        *://imgur.com/*
// @match        *://m.imgur.com/*
// @match        *://i.imgur.com/*
// @exclude      *://api.imgur.com/*
// @run-at       document-start
// @grant        none
// @license      MIT
// @noframes
// ==/UserScript==

(function() {
  'use strict';

  // Avoid loops if someone navigates directly to farside.link/rimgo
  if (location.hostname === 'farside.link' && location.pathname.startsWith('/rimgo')) return;

  // Make sure we're on an Imgur domain
  if (!/(\.|^)imgur\.com$/i.test(location.hostname)) return;

  const destBase = 'https://farside.link/rimgo';
  const path = location.pathname + location.search + location.hash;
  const target = destBase + path;

  if (location.href !== target) {
    // Use replace so the original Imgur URL doesn't remain in history
    location.replace(target);
  }
})();