Webhosting.net Internet Hosting Webhosting.net Internet Hosting
Forums | Sitemap | Resources | Home
Contact Webhosting.net
 

Go Back   Webhosting.net Forums > Software Development / Web Design > HTML / Javascript
Register FAQ Support Calendar Search Today's Posts Mark Forums Read

HTML / Javascript Very few webhosting companies don't support html or javascript! Have fun interacting with others about these ubiquitous technologies.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old October 27th, 2006, 12:13 PM
leonard leonard is offline
Moderator
 
Join Date: Dec 2005
Posts: 71
Default Anti-Leech with .htaccess

NOTE: The will only work for domains hosted under Linux plans

Create the .htaccess file

Warning: If you are using FrontPage to publish your site and have the FrontPage extension turned ON, this tutorial may not work for you. In fact, it might corrupt your FrontPage Extensions. Use at your own risk.

Open Notepad (or equivalent software depending on your OS) and paste in the following:
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://yousite.com/ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.yousite.com/ [NC]
RewriteRule [^/]+.(gif|GIF|jpg|JPG|jpeg|JPEG|png|PNG)$ - [F]


If you wish to return an image, stating they're not permitted to access your images, modify the first RewriteRule line to this:

RewriteRule [^/]+.(gif|GIF|jpg|JPG|jpeg|JPEG|png|PNG)$ http://www.yoursite.com/restricted.gif [R,L]

Save the file as .htaccess (the .txt extension will be appended).
Note: If anti-leeching is used along with sub domains, you'll need to create a .htaccess for each sub domain with the following code for protecting your images:

RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://sub.yoursite.com/ [NC]
RewriteRule [^/]+.(gif|GIF|jpg|JPG|jpeg|JPEG|png|PNG)$ - [F] # No access to images


Uploading the .htaccess file

Upload the .htaccess.txt file via FTP in ASCII mode and place in the domain folder you are protecting.
(Sub domain .htaccess files should be placed in the folder for that sub domain)

After uploaded right click the file (server copy) and choose rename
Edit the file name, so that it will be .htaccess (without the .txt extension)
Other web sites will now not be able to leech any images from your site.
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 -4. The time now is 05:00 PM.


Powered by vBulletin Version 3.6.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.