There is a site. He has outgoing links. They redirect in this way.

<input type="button" value="ΠŸΠ΅Ρ€Π΅ΠΉΡ‚ΠΈ" onclick="window.open('http://сайт-Π½Π°-ΠΊΠΎΡ‚ΠΎΡ€Ρ‹ΠΉ-происходит-Ρ€Π΅Π΄ΠΈΡ€Π΅ΠΊΡ‚.tld/redir1.html');" class="button" /> 

...

 redir2.html redir3.html 

I would like to quickly redirect all outgoing links to another specific website address, for example, Google.

To any click on the buttons with addresses

 http://сайт-Π½Π°-ΠΊΠΎΡ‚ΠΎΡ€Ρ‹ΠΉ-происходит-Ρ€Π΅Π΄ΠΈΡ€Π΅ΠΊΡ‚.tld/redir1.html redir2.html redir3.html 

Redirettil for example google

(without fixing the outgoing links in the code) so that once we can quickly return everything as it was.

What method can this be done, tell me?

htaccess?
php?

  • and this site.tld is your site? - splash58
  • No, site.tld is an external site - Andrei
  • Tell me, why do you redirect links to someone else's site? Are they definitely looking forward to your referrals? - Nick Volynkin ♦
  • Well, as an option, the announcement of articles, and the "READ MORE" button, and the articles themselves on another site - Andrei
  • And when that site stopped working for a while, then God bless them with the articles, redirect at least where, if only .... to create the appearance of the "READ MORE" buttons - Andrei

1 answer 1

C jQuery can be so

 $(function(){ var redirectToAdvertising = function() { location.href = "http://google.com/"; return false; } //Π’ Π½ΡƒΠΆΠ½Ρ‹ΠΉ ΠΌΠΎΠΌΠ΅Π½Ρ‚ вСшаСм событиС Π½Π° ΠΊΠ»ΠΈΠΊ ΠΏΠΎ всСм ссылкам Π½Π° страницС $("a").on("click", redirectToAdvertising); //Π’ Π΄Ρ€ΡƒΠ³ΠΎΠΉ Π½ΡƒΠΆΠ½Ρ‹ΠΉ ΠΌΠΎΠΌΠ΅Π½Ρ‚ - снимаСм событиС $("a").off("click", redirectToAdvertising); }); 

On native JS, it's too lazy to write, but it's not much more difficult there.