May 23 2009
Posted by Webmasters-central.com as Internet Marketing
You can use this little javascript to stop people copying your images. This is not 100% secure becaause they can view the image urls with ‘view > source’ feature of the browser and can copy your images.
Here is the javascript. You have to paste it with in the ‘head’ tags of your html code.
<SCRIPT>function click() {if (event.button==2) {alert('Ooops...\nRight click is disabled!');}}document.onmousedown=click// - -></SCRIPT>
When you are on Apache server, you can use ‘Rewrite Mode’ on your server. Just ask your web host that your web site has Rewrite mode enabled or not.
You have to keep a ‘.htaccess’ file in the root directory if you want to protect your entire domain images from hot linking. Or if you want to protect images in one folder you can keep this file in that particular folder.
How to create the ‘.htaccess’ file:
1. Open your Notepad or any text editor.
2. Paste these lines -
Rewriteengine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://yourdomain.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.yourdomain.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.your_other_domain.com/.*$ [NC]
RewriteRule \.(gif|jpg)$ http://www.yourdomain.com/error.gif
Third,fourth and fifth lines are your domain names or domain names that you want to give access to your image files. You can add as many domain names as you want.
Change ‘yourdomain’ to your web site name. You can add or delete file extentions as per your requirement in the last line and replace error.gif with your gif name.
Save this as ‘htaccess.txt’ on your computer.
3. Upload this file by ASCII mode by your FTP software.
4. Rename it as .htaccess.
If you don’t have ‘Rewrite Mode’ on your server, you can use CGI scripts to protect your images and variety of files.
Ace Bandwidth Protector: An excellent FREE script! See the demo on the web site.
Author: Radhika (c)
http://www.webmasters-central.com/
| M | T | W | T | F | S | S |
|---|---|---|---|---|---|---|
| « Jun | ||||||
| 1 | 2 | 3 | 4 | 5 | ||
| 6 | 7 | 8 | 9 | 10 | 11 | 12 |
| 13 | 14 | 15 | 16 | 17 | 18 | 19 |
| 20 | 21 | 22 | 23 | 24 | 25 | 26 |
| 27 | 28 | 29 | 30 | 31 | ||
RSS feed for comments on this post · TrackBack URI
Leave a reply