Results 1 to 18 of 18
-
01-21-2004, 04:27 AM #1Junior Guru Wannabe
- Join Date
- Jan 2004
- Location
- Alberta, Canada
- Posts
- 88
How-to - Disable Hot-linking Files.
Hot-linking files such as images and media (mp3, wma etc..) is where another website uses source code to post your media on thier page. This uses your bandwidth and the other site gets credit for this.
This snippet of code will prevent anyone but your domain to view or access your media. If others are hosting images that are yours they will simply have the big red x.
There are 4 variants of this code, experiement with them to find the one that works for you.
To implement this you will need to create a .htaccess file in the stored directory. If your images are in /web/images then you will need to post this .htaccess file in the images directory to prevent hotlinking there.
Note, only enter the tld of your domain. Such as yourdomain.com instead of www.yourdomain.com..
Application is:
cd /web/images
vi .htaccess
Paste your desired variant (some may not work with your hosting setup, try until one does).
Variant 1
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?yourdomain.com(/)?.*$ [NC]
RewriteRule .*\.(gif|jpg|jpeg|bmp)$ - [F,NC]
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?yourdomain.com(/)?.*$ [NC]
RewriteRule .*\.(gif|jpg|jpeg|bmp)$ - [F,NC]
Options +FollowSymlinks
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?yourdomain.com(/)?.*$ [NC]
RewriteRule .*\.(gif|jpg|jpeg|bmp)$ - [F,NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?yourdomain.com(/)?.*$ [NC]
RewriteRule .*\.(gif|jpg|jpeg|bmp)$ - [F,NC]
If you need to block additional file types just add thier extensions to the Rewrite Rule Line.
Removal:
Simply delete the .htaccess file in your directory.
1. rm .htaccess
Regards,
RyanLast edited by MjrGaelic; 01-21-2004 at 05:23 AM.
-
07-19-2004, 11:30 PM #2Temporarily Suspended
- Join Date
- Jul 2004
- Location
- Curently WA, USA
- Posts
- 62
erm... i think that if u have access to Cpanel u can control hotlinking like u can block your files from being hotlinked..
-
08-11-2004, 06:23 PM #3Junior Guru Wannabe
- Join Date
- Aug 2003
- Location
- Dead Lake, Michigan
- Posts
- 32
Do .htaccess files work on Windows servers?
Cheers,
Jason Henning
-
08-11-2004, 06:30 PM #4Junior Guru Wannabe
- Join Date
- Jan 2004
- Location
- Alberta, Canada
- Posts
- 88
To be honest Jason, I really don't know. I have no experience with Windows Servers what so ever..
Can anyone elese answer that question and/or provide a solution like above for Windows boxes?
Ryan
:wq
-
09-01-2004, 09:12 AM #5Junior Guru
- Join Date
- May 2004
- Location
- Central Scotland
- Posts
- 245
I don't know either but you could use another method which is actually more secure for your whole site, why not protect your source code by using encryption and also use one of those 'no right click' scripts. There are some no right click scripts that can be passed by simply left-clicking and quickly right-clicking after it, so be careful as not to pick a duff script This way all your content is protected. not just your images etc because it stops them right clicking and selecting 'save target as' or viewing your source for the file location.
-
02-10-2005, 06:58 PM #6NetOps Guy
- Join Date
- Jan 2005
- Location
- San Francisco/Hot Springs
- Posts
- 991
There's actually an apache module which can prevent hotlinking...
Even better is when you rewrite the hotlink'ed image to something shaming the hotlinker, especially if they're hotlinking copyrighted content.AppliedOperations - Premium Service
Bandwidth | Colocation | Hosting | Managed Services | Consulting
www.appliedops.net
-
05-18-2005, 12:18 AM #7Web Hosting Evangelist
- Join Date
- Sep 2003
- Posts
- 501
Do you recall the name of the apache module?
-
06-13-2005, 07:27 AM #8Newbie
- Join Date
- Jun 2005
- Posts
- 14
thanks
its also the info i need, i may give it a try. many thanks.
-
06-13-2005, 12:05 PM #9Newbie
- Join Date
- May 2004
- Posts
- 29
mod_rewrite is no longer full prove and I can tell you why..
I found people are using XML (.xml) to get thourgh mod_rewrite.
An example is an mpg file with mod_rewrite hotlinking protection. If request is not coming from your web page, apache sends error 302 and attempt to redirect, somehow, since it is .xml, with an embedded Windows Media Player, the client was not redirected to a hotlink page.
Instead another request was made to the server by the embedded player for the mpg file. At this time there is no refferal information. Then client is able to download and play the mpg file on the stealer web page and therefore stealing your content and bandwidth.
This http log might better explain what is going on...
1st request:
.....mpg HTTP/1.1" 302 312 "http://hotlinker.website/file.xml" "Mozilla/4.0 (compatible....
2nd request:
.....mpg HTTP/1.1" 206 1462276 "-" "Mozilla/4.0 (compatible....
3rd request:
.......mpg HTTP/1.1" 200 1398788 "-" "Windows-Media-Player/9.00.00.2980"
If anyone knows a method how i can prevent this type if hotlinking please shine some clue.
-
10-16-2005, 12:47 AM #10Temporarily Suspended
- Join Date
- Sep 2005
- Posts
- 3
Ive been looking for a good one for awhile. thanks!
-
02-03-2006, 12:24 PM #11Aspiring Evangelist
- Join Date
- Jul 2002
- Posts
- 436
Anything for Windows?
-
02-25-2006, 01:21 PM #12Newbie
- Join Date
- Dec 2005
- Posts
- 21
It's really easy with CPanel. Cpanel automaticaly does it for you.
-
09-16-2006, 02:58 AM #13Junior Guru Wannabe
- Join Date
- Aug 2006
- Location
- Earth
- Posts
- 72
Anything for Windows?
Use Plesk CP >> Domains >> Domainname >> Hosting >> Click Hotlink Protection and enable it.
-
09-23-2006, 06:10 AM #14Newbie
- Join Date
- Feb 2006
- Posts
- 12
you can do it automatically thru any cpanel system or editing the htaccess yourself
-
05-15-2009, 06:51 AM #15New Member
- Join Date
- May 2009
- Location
- United States
- Posts
- 1
Finally I found this good article that help me a lot to disable Hot-linking Files. I want now installing window vista on my computer so let me know do .htaccess files work on window vista?
-
08-06-2009, 07:39 AM #16Junior Guru Wannabe
- Join Date
- Oct 2002
- Location
- Singapore
- Posts
- 52
i know windows XP doesn't support .htaccess files because of the naming convention.
The content inside is definitely readable by Apache though, and Apache can definitely be run on Windows.
So even if .htaccess files can't be read, you can reconfigure Apache by editing your Apache httpd.conf file so that maybe htaccess.txt are read instead of .htaccess. Just look for this line:
AccessFileName .htaccess
And change it to this line:
AccessFileName htaccess.txt
Hope that helps█ John Lee
█ Vodien Internet Solutions Pte Ltd -------------- Latest Intel Servers Now Available!
█ Singapore Datacentre ★★ Native English staff ★★ Singapore Web Hosting
█ http://www.vodien.com ★★ 24/7 Super Support ★★ Call +6562886264
-
08-25-2009, 06:12 PM #17Newbie
- Join Date
- Aug 2009
- Posts
- 12
Thankyou so much for this!!
-
05-26-2010, 09:23 PM #18Newbie
- Join Date
- Apr 2010
- Location
- New York, USA
- Posts
- 17
Sorry for digging this up, but I can't seem to get this to work.
Does windows definitely accept htaccess files if they are named htaccess.text, because I tried that.
ThanksGamer Island - Free Flash Games
--------------------------------------------------------
iHostVPS - Cheap VPS Hosting