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.
Asked
Active
Viewed 692 times
2 Answers
2
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.
-
but some URL shortener website (like tinyurl.com, bit.ly, etc.) cannot be shortened by goo.gl. If you type those url, the Google will say, "This URL cannot be shortened. Please try another one." – Banana Code May 29 '16 at 06:37
-
@RedWhale That is because Google has specifically decided to block those links from being shortened. This is not something you can influence. – May 29 '16 at 06:40
-
So is it decided by Google themselves? Besides, how do Google know those url should not be shortened? Is there any rule? – Banana Code May 29 '16 at 06:46
-
Google's policy is explained at the "acceptable use policy" link at the bottom of the goo.gl web site. – May 29 '16 at 07:00
0
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...

ave4496
- 2,950
- 3
- 21
- 48