URL Replacer/Redirector

Redirect specific sites by replacing part of the URL.

< Feedback on URL Replacer/Redirector

Question/comment

§
Posted: 2024-08-21
Edited: 2024-08-21

I use Chrome + Tampermonkey / ViolentMonkey

I want change wrong old links in xhamster:
OLD
https://xhamster.com/stories/story-355462
TO NEW
https://xhamster.com/posts/355462

I added:
// @match https://xhamster.com/stories/*

To change the value:
In Tampermonkey i don't find ..

In ViolentMonkey, i can show and modify these values stored by your script,
by using its "Value" tab and "Show values stored".

Here the initiall values are:
{
"replacePrefix": "",
"replaceSuffix": "",
"replaceTheseStrings": {
"toReplace": "replaceWith"
}
}

I replace them by (trying to follow the example provided in the page info of the script):

{
"replacePrefix": "/stories/story-",
"replaceSuffix": "/",
"replaceTheseStrings": {
"toReplace": "posts"
}
}

TEST in a Blog where i found the wrong link (on top):
https://xhamster.com/posts/10531155



I don't see any change (page not found):
https://xhamster.com/stories/story-355462

What i do wrong ?

Gavin BorgAuthor
§
Posted: 2024-08-22

You need to change "toReplace" to whatever you want to replace, and the prefix/suffix are for identifying the bit to replace (they don't actually get replaced).


In your case, it sounds like you'd want:

{
"replacePrefix": "https://xhamster.com/",
"replaceSuffix": "",
"replaceTheseStrings": {
"stories/story-": "posts/"
}

The prefix is on all URLs, and you're going to replace "stories/story-" with "posts/".

§
Posted: 2024-08-22

Thanks!
I need to find where to find these values stored in Tampermonkey.
If you have a screen shot, perfect :-)

Post reply

Sign in to post a reply.