Web Programming  Home Web Programming PHP No Direct Linking
rss

No Direct Linking

Author: Lindsay Coome More by this author


If you want to prevent those awful direct linkers, use this tutorial. Open up your notepad (start>>programs>>accessories>>notepad) or another text editor, and copy the code below to it. Name this file .htaccess and make sure it doesn't have an extension on the end, like .txt. If it is named .htaccess.txt, rename it  .htaccess. Save it and upload it to your main directory. Or, you can upload it as .htaccess.txt, and rename it when it's on your server.  If you already have a .htaccess file in your directory, because you have an IP block or something, just put the code beneath whatever you already have.

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://WWWW.YOUR-SITE.COM/.*$ [NC]
RewriteRule .(gif|jpg)$ http://URLOFIMAGE.jpg [R,L]

.htaccess
.htaccess example

Replace http://WWWW.YOUR-SITE.COM/ with the url of your site. Replace http://URLOFIMAGE.jpg with the url of the image you want to show up instead of your own when people direct link.



Rate this Material: Bad 1 2 3 4 5 Excellent
print this page tell a friend subscribe to newsletter subscribe to rss

Add comments to "No Direct Linking"