V2EX 自动重定向

重定向 v2ex.com 的子域名至 www.v2ex.com

目前为 2021-04-24 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name V2EX Redirect
  3. // @name:zh-CN V2EX 自动重定向
  4. // @namespace http://tampermonkey.net/
  5. // @version 0.1
  6. // @description Redirect subdomains of v2ex.com to www.v2ex.com
  7. // @description:zh-CN 重定向 v2ex.com 的子域名至 www.v2ex.com
  8. // @author Jiachen Chen
  9. // @match *://*.v2ex.com/*
  10. // @match *://v2ex.com/*
  11. // @icon https://www.google.com/s2/favicons?domain=v2ex.com
  12. // @grant none
  13. // ==/UserScript==
  14.  
  15. (function () {
  16. "use strict";
  17.  
  18. if (location.hostname != "www.v2ex.com") {
  19. window.location.replace(
  20. "https://www.v2ex.com" +
  21. location.pathname +
  22. location.search +
  23. location.hash
  24. );
  25. }
  26. })();