Tag Archives: Reducing Bandwidth

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://([^/]*.)?mydomain.com/” request_ok = 1
Order Allow, Deny
Allow from env=request_ok
</FilesMatch>

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