Need help with preventing in-line linking


#1

I’ve got a site that’s in line linking my photos and other parasitical types of things. I’d like to prevent it.

I understand from this page:

http://altlab.com/htaccess_tutorial.html

that I can add some lines of code to the .htacess file that will prevent it.

My problem is that I don’t know jack about being a webmaster or any of this stuff. But I’m all we’ve got, so I’m it :slight_smile: I finally figured out how to access my root folder via webftp, so that’s a plus.

Do I create an .htaccess file and add the code there? If so, how? Would anyone take pity on a poor soul and show me how step by step?

Or are there other ways to do squash inline linking through cpanel? Or should I try Cloud Flare, which apparently allows one to do this as well? Any experiences with this?

Thanks for your time.


#2

You have to edit your .htacess file, which you apparently found already. So now all you need to do is add some lines to the .htaccess file. Something like this:

RewriteEngine On RewriteCond %{HTTP_REFERER} ^https?:// [NC] RewriteCond %{HTTP_REFERER} \b(badsite\.com|badsite2\.org)\b [NC] RewriteRule *.(jpg|png) /blocked.jpg [L,R]

I haven’t tested this, just written out of my head the way I think it should be. It’s specifically if you just want to block “badsite.com” and "badsite2.org, etc… (you can extend the list). This example blocks jpg and png, you can also extend that to include whatever you need. And obviously you can change blocked.jpg to whatever you want to redirect them to (including a webpage).

Note that redirecting an image to a webpage, ends up showing them nothing when the hotlink is embedded in another page, because the browser expects an image and not html.

Do remember that the visitor (that will see the image you redirect to) is not responsible for the site that hotlinked your image, so don’t insult them or tell them they did something wrong, when it’s actually not their fault.

You can also write the rule so as to block everything that doesn’t come from your site (but personally I think that easily causes unwanted collateral damage if you are not careful).


#3

“Or are there other ways to do squash inline linking through cpanel? Or should I try Cloud Flare, which apparently allows one to do this as well? Any experiences with this?”

CloudFlare does offer a Hotlink Protection feature for sites that are signed up for CloudFlare. You can also protect your content with ScrapeShield.

The larger question is if you want to allow hotlinking at all, which would require creating a hotlink ok folder (for sites you want to be able to hotlink).


#4

http://wiki.apache.org/httpd/DisableImageHotLinking

For me the second one with the FilesMatch works like a charm this way I can whitelist my domains and everybody else gets nothing.

Jw