Prevent Image Hotlinking in Easy Steps

hotlinking
How to prevent image Hotlinking?

If you are going to allow image hotlinking, anyone can use your images on their websites and your bandwidth will be utilized. This is a common problem with so many website owners.

Creating a .htaccess file on your TNP HOST web server
  • Go to File Manager in your TNP HOST cPanel
  • Click Create File
Add the following code to your .htaccess file in your TNP HOST web Server

By entering the following code in your .htaccess file , you can prevent Hotlinking on your server :

** Make sure to change example.com to your own URL you used while you hosted your website on TNP HOST server.


Block only Specific Domain

The following code will help you block only specific domain on TNP HOST web Server

Allow only Specific Domain

The following code only allows specific sites to load content. For example, the site example.com has all of the content. The following code allows only example.com and tnphost.com to load the content. All other sites attempting to request any resource fail to load the resource, but no errors are thrown:

In addition, since a user agent may not always specify an HTTP_REFERER value, the RewriteCond %{HTTP_REFERER} !^$ line allows the request to go through if the HTTP_REFERER value consists of a blank string.

Using an .htaccess file on your website is unlikely to cause any problems. However, it is possible for errors to occur if the rules entered into the file are incorrect which may cause your site to suddenly display a 500 error. If something like this occurs, you can comment out the rules/lines you have just added by placing a ‘#’ in front of each line. Repeat this until you find the line causing the error.

If you having any difficulties following this article, please comment below. TNP HOST support representative will get back to you with best possible solution. To Buy hosting for your website, click here

Was this post helpful?
Let us know, if you liked the post. Only in this way, we can improve us.
Yes
No

Leave A Comment?

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