Monday, December 7, 2009

Prevent Direct Linking for PHP sites

Prevent Direct Linking for PHP sites
 If you want to prevent those awful direct linkers, use this PHP 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 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.

That's All.......

Related Posts by Categories


Post a Comment

Maybe this is what you looking for


Subscribe Now


IT Skill is not enough... Copyright © 2009 Designed by Bie Blogger Template