Want to prevent direct linking to your files? Sick of people linking to files that you feel should only be accessed from your website and not their’s? Read on…
Open your notepad.
Insert the follow code as it is displayed and change “mydomain.com” to your own domain name:
RewriteEngine on RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http://mydomain.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://www.mydomain.com/.*$ [NC] RewriteRule .(gif|jpg)$ - [F]
Click Edit-> Save As.
Save as .htaccess (don’t forget the period). Select “All Files” from the drop down menu below the box where you give your file a name when saving. Click ok once you save it to the folder you prefer it to reside until you upload it.
Now open you ftp program. Browse your folders on your computer til you find where you saved it. Login to your website. Upload it to root (Sometimes the folder is called public_html or httdocs or whatever. Upload where your main index file resides.). Some servers will not show the file you just uploaded. But it’s there. Other servers may show it. If you have cpanel for your control panel, you can see it with your file manager.
That’s it! Upload it to all your domains if you like. You are done!



