• Resolved jonasskalbo

    (@jonasskalbo)


    Hi there,

    I’m trying to create a redirect that will apply to all affiliate links.

    Source: domain.com/recommended?target=targetdomain.com
    Intended target: targetdomain.com

    I haven’t figured out how to redirect from the source to a URL query. Is there an easy way to do this?

    Appreciate the help.

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

    (@johnny5)

    I haven’t figured out how to redirect from the source to a URL query

    I don’t really understand what you mean here. Can you explain it further?

    Thread Starter jonasskalbo

    (@jonasskalbo)

    Sorry if I wasn’t clear. I want to set up a dynamic target URL based on the query parameter “target” from the source URL (as the example above).

    I will have hundreds of links that look like this:

    example.com/recommended/?target=targetdomain.com/1
    example.com/recommended/?target=targetdomain.com/2
    example.com/recommended/?target=targetdomain.com/3

    These three examples will be redirected to the corresponding targets:
    targetdomain.com/1
    targetdomain.com/2
    targetdomain.com/3

    I would love it if I didn’t have to set up each individual redirect, but merely redirect based on the “target” parameter, and that way only set up a single regex match redirect.

    Hope this is more clear.

    Plugin Author John Godley

    (@johnny5)

    You can use a regular expression for this:

    https://redirection.me/support/redirect-regular-expressions/

    Be aware that what you have proposed is an open redirect. If you are not careful then people can use your site to redirect people to bad sites (example.com/recommended/?target=baddomain.com), which can be used for phishing.

    You should make sure your expression only works for the specific target domains you allow.

    Thread Starter jonasskalbo

    (@jonasskalbo)

    THanks a bunch. Appreciate the added information you provided.

    Have a great day John.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Target from Source URL Query’ is closed to new replies.