View Full Version : codes to prevent off site linking

10-08-2002, 01:22 PM
Hi, the title pretty much gives away what I'm looking for. I've searchd a little but couldn't find it.

Does anyone know the code for HTML to prevent ppl from off site linking pictures, etc. ???

Thanks :)

-- alovelyhug

10-08-2002, 02:17 PM
Ilayda, hi,
you can't do that with HTML. Well you can by changing the names of your images every day but there is another solution.
Here's a tutorial: http://www.wsabstract.com/howto/htaccess.shtml

If it's about the site in your profile, this is what you need. Prevents hotlinking and redirects to your main page (from places like Google's image search).

RewriteEngine On
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://www.mysite.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://mysite.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.mysite.com:80/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://mysite.com:80/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^*$ [NC]
RewriteCond %{HTTP_REFERER} !^*$ [NC]
RewriteRule .*\.(jpg|JPG|gif|GIF)$ http://mysite.com/index.html [R,L]

10-08-2002, 02:27 PM
Hi and thanks MCookie :)

Yes, it is for my site and mostly for images, and I'm not sure what redirects mean? when someone is linking to my site?

I'll try your code and take a look at that site.

One question still, where exactly do I put the code? Head/body tag? or does it not matter where?

-- alovelyhug

edit: oh i'm sorry, I got what you meant with redirecting , my bad !

10-08-2002, 02:50 PM
>> where exactly do I put the code? Head/body tag? or does it not matter where?

Yes, it does matter where you put it... no, don't put it in anywhere in your page. It's not supposed to be on any page but in a file called .htaccess. Changing server settings..
So be sure to read the tutorial before copy-pasting anything... http://www.wsabstract.com/howto/htaccess.shtml

10-08-2002, 03:14 PM

oh God. I thought it was easier.

I'll try it anyway.

thank you so much for your help

-- alovelyhug

10-08-2002, 03:33 PM

Well you don't have to study regular expressions to copy, paste and upload. It's just a file with 9 lines of code :)

10-08-2002, 03:44 PM
hey, I'm not a pro like you

5 months ago html, etc, was a mystery to me so bear with me. First off, I have to read the tutorial to find out how or where that file is.

10-08-2002, 04:45 PM
There's no need to look for the file :)

Open notepad, paste the above code into it. Save it as .htaccess then simply upload to your site.

10-08-2002, 05:13 PM
Okay, thank you Nightfire (nice sn btw) . I'll try that tonight :)

-- alovelyhug

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum