Disable hotlinking generator

* note - this will not work on a windows system
Hotlinking is where someone else puts a link to your images or files from their website. In the case of images, this loads the image on their website which increases your bandwidth which you will ultimately pay for.

You can stop this from happening by placing a '.htaccess' file in the folder where your images are stored. This will only allow requests from your own pages to display the images - anyone linking to them from outside of your website, or any website you choose, will have the 'red x' instead of the image.

Alternatively, you can set the code to block particular referrers - so do not allow certain domains to hotlink your images or files.

Use the following form to create the code to place into your htaccess file to stop people hotlinking your images/files. The code uses mod_rewrite.
  • Enter the urls which you want to allow to link to your images/files. This would normally be the site where the images are stored, however you may have several websites which you would like to allow to use your images.
  • If you put the htaccess file in the domain root folder, ie http://www.yourdomain.com, this will affect every folder under it.
  • If you have subdomains that link to the images, you will need to add the subdomains in the list.
  • When someone hotlinks your files, you can have the link redirect to a page of your choosing. The front page of your site is a good idea! Enter the url you wish links to be redirected to.
  • Enter the file extensions you wish to block hotlinking on. Use lowercase, and seperate each one by a space.
  • Copy the generated code and paste it into notepad and save it as htaccess.txt. Upload it in ASCII format to the folder your images/files that you want to block are stored in and rename it to .htaccess (remember the dot!!)
  • Unless you have your ftp program set to show invisible files, the file will then disappear from sight. Don't worry, it's still there!
  • If you have an existing htaccess file, copy and paste the generated code into that.
  • Note: only enter the base domain, without the protocol (http://) and without the www.
  • Note: if you are blocking all traffic except yours and your website uses a dedicated IP, also enter the IP address i.e.: otherwise anyone accessing your domain through the IP won't be able to see the images
Hotlinking options

File extensions to block
Seperate with spaces. No 'dots' needed. Remember...if blocking jpg files, include jpeg. Add as many file types as you wish. If you wish to block access to all files, enter *
Website URLs
Include the URL for your website otherwise your website will be blocked too. Also add any other websites that you would like to allow to hotlink, such as Pinterest or Facebook.

Do not enter the protocol (http:// or https://) or www, the generated code will allow for both.
Social media and search engines
You can allow social media platforms and search engines access to the files on your website. Entries checked here will automatically have the corresponding URL included.

Choose which ones you would like to allow:
You can allow/block other user agents here - for example, to block the Russian search engine 'Yandex' just enter yandex, or baidu for the Chinese search engine Baidu. You only need a partial string here, but make sure it's a string that is unique to the user agent. If you want to allow these agents, add the URL for them in the URL section
Blank referrers
Some browsers do not send referrer information, so they come through as a 'blank referrer'. Also, if someone goes to your file directly it will not show a referrer. You can block blank referrers, but you may find that some visitors to your website cannot see your images.

If you have music files etc which are not accessed from a webpage, you will more than likely find there is no referrer information sent with the request.

Only choose to block blank referrers if you are having a lot of trouble with people hotlinking your images and no referrer information is being sent through.
Image replacement
You can choose to redirect hotlinking requests to an image with a message stating hotlinking is not allowed. You will want to make sure that this image is very small in kb, otherwise it defeats the purpose.

If you don't care that the website hotlinking just has a red 'x' instead of the hotlinked image, leave this field blank.
URL to of image:
Caution!!!! Make sure the image url you enter here is NOT an image that falls under the blocked domain. This can cause a server loop, as it's trying to access an image which is blocked, which then tries to access the image again - which is blocked. Your safest bet is to rename a .jpg file to .jpe (this should still work) and don't put the .jpe extension in your list of blocked image extensions.
Share the Disable hotlinking generator on Facebook