Think Visualizer and expand your options
 
Visualizer Navigator 
   Home | Keep up with the news | The Photo FX tour | Photo FX Bookmark and Share

Go Back   Visualizer Forums > Visualizer Online Learning > Web design and Scripting
User Name
Password
Register FAQ Members List Search Today's Posts Mark Forums Read


Reply
 
Thread Tools Search this Thread Display Modes
Old 12-27-2004, 02:11 PM   #1
Darren
VIG, Project Manager
 
Darren's Avatar
 
Join Date: Aug 2004
Location: US of A
Posts: 1,861

my photo blog, by Darren
Default Avoid Hotlinking from other servers

If you have files on your server which people are not allowed to download from a third party website, setting up an .htaccess file can easily block servers from hotlinking. The example below will show you how.

Open up you default text editor such as Notepad and add the following lines.

Code:
RewriteEngine on RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain.com(/)?.*$ [NC] RewriteRule .*\.(zip|rar|gz|exe)$ [F,NC]


This code will switch on the mod_rewrite engine and setup the referer which allows people to download files when visiting your site, but does not allow any third party domain to hotlink to any zip, rar, gz or exe files.

If you own another server or if you a partnering with another web site, you can allow these to dowload files from your server. To do this just add the following HTTP_REFERER to your .htaccess file as I did below.

Code:
RewriteEngine on RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain.com(/)?.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://(www\.)?anotherdomain.com(/)?.*$ [NC] RewriteRule .*\.(zip|rar|gz|exe)$ [F,NC]


If you are using Notepad, make sure before you save the file as .htaccess that you have selected All files where it says Save as type.

Now you can upload the .htaccess file to any folder on your server, just keep in mind that the folder you upload your .htaccess file to, that all subfolders within that folder will be affected by this rule.
__________________
Project manager
Visualizer Image Group


"Don't judge yourself on how far you have come,
It's better to get somewhere than nowhere"
Darren is offline  Live RSS Feed from my photo blog   Reply With Quote
Old 05-17-2006, 08:25 PM   #2
supertech1
Junior Member
 
supertech1's Avatar
 
Join Date: Feb 2006
Posts: 17

Default

Just a quick note, the .htaccess file does not work on Windows-based servers. In this case, settings like this can be configured directly in IIS. See the current Microsoft Developer website for more info, as the instructions are different for each version. I can't give you a direct link to the Microsoft Developer website, as they keep changing it, but it is accessible from the complex menus on http://www.microsoft.com . Don't expect user-friendly guides, though; Microsoft is QUITE well-known for their website's ease of use (sarcasm implied). No offense meant to anyone.
__________________

Techsoft Advanced Administrator
supertech1 is offline   Reply With Quote
Old 05-17-2006, 08:29 PM   #3
Darren
VIG, Project Manager
 
Darren's Avatar
 
Join Date: Aug 2004
Location: US of A
Posts: 1,861

my photo blog, by Darren
Default

Very true, I forgot to mention that it was intended for Unix servers. Thanks for pointing out my missing details supertech1
__________________
Project manager
Visualizer Image Group


"Don't judge yourself on how far you have come,
It's better to get somewhere than nowhere"
Darren is offline  Live RSS Feed from my photo blog   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump



All times are GMT. The time now is 04:29 AM.



Copyright © 2002-2006 Visualizer Image Group.