2

I run a giant community. Many spammers will use link shorteners or .tk domains that 301 to their spam offer. How are sites detecting the final domain and is this a viable solution to block spam?

ex. I'll just block the spam: bit.ly/xdfd but then they will just use a different shortened link.

  • Building off what @Baptiste said, you might mention what forum/CMS/etc you're using as there could be a feature or plugin of some kind that'll handle this for you. – Su' Sep 14 '12 at 10:38
  • it's a custom site. j0k gave me some good ideas, thanks – surpr Sep 15 '12 at 19:08
6

There is plenty solutions to expand short url:

When user submit a new post, you can apply a function that expand url for all url inside the post. Then you will have the real url. So you can appy what ever spam solution you use to reject / accept the post.

You can also replace the shorten url by the full one to avoid short link on your commutiy board.

| improve this answer | |
1

Many forums simply forbid all url shorteners. There is no simple solution to that, you may try also specific solutions for your platform (phpBB, vBulletin, etc.)

| improve this answer | |
0

I looked at this a decided the best solution was to simply ban all shortened links, it will be very rare that a user will want to post such, but spammers love them.

I used code based on the accepted answer here https://stackoverflow.com/questions/9557116/regex-php-code-to-check-if-a-url-is-a-short-url

| improve this answer | |
  • 1
    The code in from Stack Overflow won't really help. It is trivial to add a query string to shortened URLs and still have them work. Then they can be used to spam your site, but won't get caught by your code. Something like bit.ly/2NCge1I?a – Stephen Ostermiller Jun 27 at 16:56
  • A URL shortener is different than just a "short URL". For example http://bk.com/faq is a short url, but not a "url shortener". Conversely, http://tinyurl.com/example is a longer url from a legit url shortener. Whatever solution you use, it won't be accurate if it's based solely on length. – Maximillian Laumeister Jun 27 at 20:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.