How to make my website avoid being redirected from the URL shortener site (Like goo.gl)?

845 Views Asked by At

I have make a website that I hope everyone can access it directly, not access via the shortened url. That is, I do not allow anyone to shorten my website address. How can I do to my website? Thanks.

2

There are 2 best solutions below

4
AudioBubble On BEST ANSWER

You can't.

While it is (sometimes!) possible to detect that a visitor has reached your site from a link shortener, there is no way to prevent a user from creating a shortened link which points to your site, nor is there any way for you to prevent users from clicking such a link.

You will just have to accept this and move on.

0
ave4496 On

Return the referrer of the current document:

var x = document.referrer;

there you could parse the url and see if it is yours.

It doesn't always work but I guess about 90% of the time. Depending on browser settings and so on...