How To Restrict Other Servers From Accessing Your Files ?

If your site stores popular image files then for reducing bandwidth usage you can use this Apache hack for denying servers to access your files. Open your sites .htaccess file for editing and add the following code:

<FilesMatch “.(gif|jpe?g)$”>
SetEnvIf Referer “^http://([^/]*.)?” request_ok = 1
Order Allow, Deny
Allow from env=request_ok

This restricts other domains form accessing all GIF or JPG files in  your website.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.