Sign up and get sponsored free and support your cause!!!


BASIC HTML
Coding & PHP
Computers
Layout Building
Making Graphics
Photoshop
Stylesheet/CSS
Wordpress
VIDEO TUTORIALS
EXTRAS



« Go back to Trixinity.net

Disable Direct Linking using HTACCESS

What is it?
Direct linking (hot linking) is bad and illegal. Websites pay for the bandwidth they use to host images and direct linkers steal it. Its illegal to do so but still you will find many people doing it. You can not stop each one of them by emailing their hosts. There is a better way of saving your bandiwdth : disabling direct linking from your site. (If you are a resource website you most likely have your images uploaded to an image host, you can still use this code and those images will be fine).

Open a text editor and copy and paste the following code in it.

RewriteEngine on RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http://(www\.)?yoursite.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://(www\.)?yoursite.com.*$ [NC] RewriteRule \.(gif|jpg)$ - [F]

Change the 'yoursite.com' with your domain name and save this file as .htaccess.
If you already have a .htaccsess file, you can just add the above code anywhere in it.

Upload the .htaccess file to your root directory. The above code will diable direct linking of .jpg and .gif images from your site as long as your host supports mod rewrite, which most of the hosts do support.







Back to TutorialsHomeHelpContactPrivacy
© Copyright 2008. Nicky - Trixinity.net. All Rights Reserved.