Prevent hotlinking on your media files

Whenever you want to ban/prevent hotlinking your media files and protect your server’s resources and bandwidth you may use the following snippet in the .htaccess file of your main directory of your site.

Just replace YOURSITE.YOURDOMAIN with your site and at the fourth row of the actual code (don’t mind the # comment line) you can put whatever file extensions in the brackets () separated by | sign – (X|Y|Z).

How it works?

Well, it just tells the server to ban all third parties from accessing your data so only your site can display that info and that’s it.

PS: If you are a WordPress user and you don’t want to mess with any code this plugin is for you : )


Spread the love