• Resolved cennadron

    (@cennadron)


    I have an affiliate blog that uses Pretty Links URL shortener (WP plugin) to make complicated links shorter and nicer looking. I then link some of the text and all the images in my posts to those shortened links. These links look like this:

    https://www.mydomain.com/recommends/nameofthesponsor
    https://www.mydomain.com/promovideos/nameofthesponsor

    or just:

    https://www.mydomain.com/nameofthesponsor

    Is there a way to force these links to always open in a new tab/window with this plugin, even though they appear to be internal (from mydomain.com)? I can see that under settings there is the option:

    Force links to open in a new window if they match this JS regular expression:

    But I have no idea how to write the regular JS expression for this. If this is possible to achieve, could you please help me with writing the JS regular expression?

    The page I need help with: [log in to see the link]

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

    (@webfactory)

    Hi,
    It is possible but you have to post your site URL and give us a list of all the URL “templates” you use like the 2 you listed above. For your 3rd URL … that’s gonna be tricky as domain.com/sponsor/ is the same as domain.com/about-us/ … no prefix or anything impossible to tell apart.

    Thread Starter cennadron

    (@cennadron)

    Hello,

    Thanks for your reply.

    Please keep in mind that the domain in question is NSFW (contains adult material).

    As I wrote in the original post, these are the 3 formats of the shortened links that I’d like to open in a new tab when the visitor clicks them:

    1) https://www.roughstraightmen.com/recommends/nameofthesponsor
    2) https://www.roughstraightmen.com/promovideos/nameofthesponsor
    3) https://www.roughstraightmen.com/nameofthesponsor

    I can’t write now all the possible combinations with all the sponsors due to space constraints, and I don’t think that’s needed anyway.

    If possible, please write the regular JS expression that would encompass all three variants of the pretty links. Even if the about-us page opens in the new tab as a result of this, I don’t care. Of course, other pages such as /wp-content/uploads/ etc. shouldn’t be affected.

    If the regular JS expression that would encompass all 3 variants is not possible to write, then please try to include the first 2 variants. I could then ask my hosting to retroactively change all the shortened links of the 3rd variant into the variant 1 or 2 by making find/replace changes in the database.

    Actually, it would be best to know both combinations: A): the regular JS expressions for 1st + 2nd + 3rd variants AND B): regular JS expression for only 1st + 2nd variants.

    Thanks in advance!

    Plugin Author WebFactory

    (@webfactory)

    Hi,
    3rd one is not possible – I can tell you that straight away ??

    My colleague will have a look at the first 2 (@talextech).

    If you have a minute please rate the plugin. It’s what keeps the support free. Thank you. https://www.ads-software.com/support/plugin/open-external-links-in-a-new-window/reviews/

    Thread Starter cennadron

    (@cennadron)

    Hi,

    I hope you haven’t forgotten about my question. ??

    I’m still waiting for that regular JS expression. It’s fine if it can encompass only the first 2 formats of the pretty links.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to force links from my own domain to open in new tab?’ is closed to new replies.