Search code examples
javascriptjquerybrowsergreasemonkeyhttp-redirect

Redirect links from old to new domain as I browse?


So my use case is something like this -

We used to access JIRA site with an old domain:

https://domain1/browse/TKT-12100

Now the domain is moved to:

https://domain2/browse/TKT-12100

But my browser history has all links with domain1. I usually type a few keywords in my browser URL tab and auto complete and enter. Now at this point I want to dynamically replace domain1 with domain2 so that my JIRA tickets load fine. I hate the manual step here.

I am looking for something on lines of Greasemonkey script to achieve this but any other methods are also welcome.


Solution

  • Here how it finally worked for me. Apparently grease monkey scripts do not work if the server is not live. So first I changed /etc/hosts file to -

    IPOfDomain2 domain1 domain2
    

    Post this change GM script is working fine - https://gist.github.com/aniket91/464ed8f61ecdeec7cf99ae65ea6514c9