Website Protection

Before I start this section let me tell you that there is no way to completely protect your pages and images. But these are some precautions you can take against spambots and hotlinkers.

The reason why I’ve been protecting my pages in the past was that some vistors (mainly very young girls) would just copy and paste my complete page to hotlink it somewhere on a free server. Hell, someone even copied my entire blog entries, and I thought my life was boring Wink
Nowadays I use .httacess files inside my image folders to prevent pepople from hotlinking, since it was eating up my bandwidth and more. And when it comes to my code or stylesheet? Feel free to have a peek!

Protect your e-mail address

Sometimes there’s no way of getting around displaying your e-mail address in the html code. Spam bots will trace it and fill your inbox with unwanted mail, also known as spam (O_o). By scrambling your e-mail address you will fool a lot of these bots. Please visit this page to scramble your e-mail.

Another way to fool bots is to create a small image which contains your e-mail address.

This might also do the trick: place REMOVETHIS before the domainname, inside del tags:

username@REMOVETHISgmail.com

Protect your pages through a .htaccess file

When your website is hosted on a Unix or Linux server, you can use a .htaccess file to prevent direct linking/leeching and block certain ip adresses.

  1. Open a new document in a text editor like Notepad and save it as .htaccess (nothing more, nothing less) in the folder you want to protect. For instance the folder where you keep your images. Place the images from your layout outside that folder, because it might affect your index page.
  2. Place the following text in the .htaccess file, so people can’t read it:
    order allow,deny
    deny from all
  3. Use this code to prevent direct linking, if people do so a broken image will appear on their screen. Don’t forget to change domain.com in the name of your domain (in my case it would be kao-ani.com)
    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http://(www.)?domain.com/.*$ [NC]
    RewriteRule .(gif|jpg|png|zip)$ - [F]
  4. If you would like people to see a no direct linking image, make one (or use the picture below) and call it linking.gif
    no direct linking image
    Place it in the main directory of your website and replace the last line to the previous code with this one:RewriteRule .(gif|jpg|png|zip)$ http://www.domainname.com/linking.gif [R,L]
  5. Once you’ve uploaded your .htaccess file you can use the hotlinkchecker to see if the script works!
  6. you can use someones ip adress to keep them away from your website, if they are giving you problems. Banned users will get a 403 "forbidden" error. However, this person could still access your website from another computer.
    order allow,deny
    deny from 123.456.78.90
    allow from all
  7. This is a small list of bots that you might want to keep away from your site. They will crawl and copy your pages, which can increase your traffic a lot. Please visit this page for a more complete list.
    RewriteCond %{HTTP_USER_AGENT} Wget [OR]
    RewriteCond %{HTTP_USER_AGENT} CherryPickerSE [OR]
    RewriteCond %{HTTP_USER_AGENT} CherryPickerElite [OR]
    RewriteCond %{HTTP_USER_AGENT} EmailCollector [OR]
    RewriteCond %{HTTP_USER_AGENT} EmailSiphon [OR]
    RewriteCond %{HTTP_USER_AGENT} EmailWolf [OR]
    RewriteCond %{HTTP_USER_AGENT} ExtractorPro
    RewriteRule ^.*$ X.html [L]

Robots.txt

I’m using a robots.txt file to disallow robots to search through my images. This way they won’t be displayed on -for example- Google Images. Some people somehow think that everything they’ll find in Google Images can be used without credit or anything Wink.

This is the text I use:
User-agent: *
Disallow: /*.gif$
Disallow: /*.jpg$

Just use a program like notepad to create a file called robots.txt containing the text above and place it inside your main directory.
But there are more codes possible and you can also block a directory on your site or specific bots.
Read more on Google Support and on the official robots.txt site.