Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author John Godley

    (@johnny5)

    Thread Starter sjoerd89

    (@sjoerd89)

    I tried this but so far it is not working:

    https://www.zilvertron.com/product/801896-smi21-dc-borstelloos-3/
    In this example above, this part is always the same -dc-borstelloos-3/ only the number changes. So i would like all links with
    -dc-borstelloos-3/
    -dc-borstelloos-4/
    -dc-borstelloos-5/

    to link to the new website.

    I tried ^/-dc-borstelloos-3/.*

    Plugin Author John Godley

    (@johnny5)

    You can use https://regex101.com/ to test your expression. The one you gave above does not match your URL.

    Thread Starter sjoerd89

    (@sjoerd89)

    I do not understand what you mean with “does not match your URL”. I would think that everything that includes the ^-dc-borstelloos-3/ part will redirect. I even found that ^-dc-borstelloos-\d should work somehow but can’t find out what i am doing wrong still.

    Plugin Author John Godley

    (@johnny5)

    ^/-dc-borstelloos-3/.* will match /-dc-borstelloos-3/thing. It won’t match /product/801896-smi21-dc-borstelloos-3/

    https://regex101.com/r/Q8h8Fs/1/

    Thread Starter sjoerd89

    (@sjoerd89)

    Okay so it is not possible to have it look for a part of the url. And if that part of the ulr is there then it redirects. Because i do not want to redirect every link with /product/ but only products that have the number behind it.

    Plugin Author John Godley

    (@johnny5)

    Yes, it is possible, but your expression isn’t matching that.

    You have a ^ at the beginning which means that it will start matching at the beginning of the URL. The URLs you are trying to match do not begin /-dc-borstelloos-3/

    As I said above, you will need to modify your expression to match your URL. There is a lot of information on the page I linked to, and a lot on the internet in general – this is not specific to Redirection.

    I haven’t tested this but you could start with something like ^/product/.*?-dc-borstelloos-3/.*

    Thread Starter sjoerd89

    (@sjoerd89)

    Thanks for helping me out!

    Starting to understand the redirection language ??

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Link is almost the same’ is closed to new replies.