Created
January 7, 2026 12:00
-
-
Save dobladov/62c4be59d774347cb480b115969a5f72 to your computer and use it in GitHub Desktop.
Redirect X/twitter to xcancel
This file contains hidden or 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 Redirect X/Twitter to XCancel | |
| // @namespace http://tampermonkey.net/ | |
| // @version 1.1 | |
| // @description Redirects x.com and twitter.com URLs to xcancel.com | |
| // @author You | |
| // @match *://x.com/* | |
| // @match *://www.x.com/* | |
| // @match *://twitter.com/* | |
| // @match *://www.twitter.com/* | |
| // @match *://mobile.x.com/* | |
| // @match *://mobile.twitter.com/* | |
| // @grant none | |
| // @run-at document-start | |
| // ==/UserScript== | |
| (function() { | |
| 'use strict'; | |
| const TARGET_HOST = 'xcancel.com'; | |
| // Prevent infinite loops if the script somehow runs on the target domain | |
| if (window.location.hostname === TARGET_HOST) return; | |
| const url = new URL(window.location.href); | |
| url.hostname = TARGET_HOST; | |
| url.protocol = 'https:'; // Ensure HTTPS | |
| // Perform the redirect | |
| window.location.replace(url.toString()); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment