Blocking links from certain websites on an Apache web server?


This might be a strange request, but I was looking for an elegant way to block or redirect traffic to my website from certain websites. I'm running an Apache webserver.

I've been playing around with the documentation for htaccess etc., but can't find anything exactly like what I'm looking for.

As an example, let's say I want to ban all traffic from R*ddit or 4gag and redirect links from those sites to an error page. How would I go about doing this? I'm not sure if it's possible without resorting to Soydet-tier server-side scripts, but I might be wrong.