{"id":39521,"date":"2022-07-27T15:00:29","date_gmt":"2022-07-27T13:00:29","guid":{"rendered":"https:\/\/qodeinteractive.com\/magazine\/?p=39521"},"modified":"2022-08-12T09:18:54","modified_gmt":"2022-08-12T07:18:54","slug":"how-to-prevent-hotlinking-in-wordpress","status":"publish","type":"post","link":"https:\/\/qodeinteractive.com\/magazine\/how-to-prevent-hotlinking-in-wordpress\/","title":{"rendered":"What is Hotlinking and How to Prevent It in WordPress"},"content":{"rendered":"<div class=\"wpb-content-wrapper\"><p>[vc_row][vc_column][vc_column_text]Whatever kind of website you are running, we\u2019ll bank on it containing\u2026 content. And creating, hosting and presenting content has a cost: in time, money, personnel hours, hosting space, bandwidth, electricity, and even environmental impact: you name it. But you already know this, don\u2019t you? You have to invest something to build anything. So what are we on about? Well, there are ways bad actors make unscrupulous <strong>use of other people\u2019s resources<\/strong>, and hotlinking is one of them. In this article, we will be talking about how you can <strong>prevent hotlinking and safeguard your resources.<\/strong>[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]But what is hotlinking? Is hotlinking all that bad? How does it affect your website\u2019s resources? We will attempt to answer these questions, and others, in the subsequent section of this article. If you feel you know enough about hotlinking already and just want to learn how to <strong>prevent hotlinking<\/strong> to your website, feel free to select the tutorial section from the table of contents below right away.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]Here\u2019s what we\u2019d like to talk to you about:<br \/>\n[\/vc_column_text][vc_empty_space height=&#8221;22px&#8221;]<ul class=\"qodef-unordered-list-item qodef-toc\">\n    <li>\n\t        <div class=\"qodef-ul-title-holder\">\n            <span class=\"qodef-ul-title-content\"><a href=\"#what-is-hotlinking\">What Is Hotlinking<\/a><\/span>        <\/div>\n            <\/li>\n<\/ul>[vc_empty_space height=&#8221;5px&#8221;]<ul class=\"qodef-unordered-list-item qodef-toc\">\n    <li>\n\t        <div class=\"qodef-ul-title-holder\">\n            <span class=\"qodef-ul-title-content\"><a href=\"#how-does-hotlinking-affect-your-website\">How Does Hotlinking Affect Your Website<\/a><\/span>        <\/div>\n            <\/li>\n<\/ul>[vc_empty_space height=&#8221;5px&#8221;]<ul class=\"qodef-unordered-list-item qodef-toc\">\n    <li>\n\t        <div class=\"qodef-ul-title-holder\">\n            <span class=\"qodef-ul-title-content\"><a href=\"#how-to-prevent-hotlinking\">How to Prevent Hotlinking<\/a><\/span>        <\/div>\n            <\/li>\n<\/ul>[vc_empty_space height=&#8221;80px&#8221;][vc_widget_sidebar sidebar_id=&#8221;new-top-picks-banner&#8221;][vc_empty_space height=&#8221;80px&#8221;][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]<\/p>\n<h2 class=\"qodef-h4\"><a id=\"what-is-hotlinking\"><\/a>What Is Hotlinking<\/h2>\n<p>[\/vc_column_text][vc_empty_space height=&#8221;21px&#8221;]<div class=\"qodef-single-image-holder    \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"970\" height=\"554\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2022\/07\/What-Is-Hotlinking.jpg\" class=\"attachment-full size-full\" alt=\"What Is Hotlinking\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2022\/07\/What-Is-Hotlinking.jpg 970w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2022\/07\/What-Is-Hotlinking-300x171.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2022\/07\/What-Is-Hotlinking-768x439.jpg 768w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2022\/07\/What-Is-Hotlinking-620x354.jpg 620w\" sizes=\"auto, (max-width: 970px) 100vw, 970px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]Hotlinking is known by various other names, including piggybacking, leaching, inline linking, direct linking, and offsite image grabs. Take a good look at some of those terms, such as <strong>piggybacking and leaching<\/strong>: they are very evocative, coming close to being self-explanatory.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]What it means is <strong>the use of an object belonging to one website on a web page of another<\/strong> web site. For instance, a website could be hotlinking to another website\u2019s image.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]This is<strong> built into the architecture of the internet<\/strong> \u2013 specifically, hotlinking is a feature of HTTP. All links are functionally the same, and all resources can be located on any server. HTTP has little regard for <a href=\"https:\/\/qodeinteractive.com\/magazine\/quick-guide-to-copyright-for-website-owners\/\">copyright<\/a>, though. It was created to make information sharing easier, not more difficult. This means that, in case you want to prevent hotlinking, you need to take some steps yourself.[\/vc_column_text][vc_empty_space height=&#8221;68px&#8221;][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]<\/p>\n<h2 class=\"qodef-h4\"><a id=\"how-does-hotlinking-affect-your-website\"><\/a>How Does Hotlinking Affect Your Website<\/h2>\n<p>[\/vc_column_text][vc_empty_space height=&#8221;21px&#8221;]<div class=\"qodef-single-image-holder    \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"970\" height=\"554\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2022\/07\/How-Hotlinking-Affects-Your-Website.jpg\" class=\"attachment-full size-full\" alt=\"How Does Hotlinking Affect Your Website\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2022\/07\/How-Hotlinking-Affects-Your-Website.jpg 970w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2022\/07\/How-Hotlinking-Affects-Your-Website-300x171.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2022\/07\/How-Hotlinking-Affects-Your-Website-768x439.jpg 768w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2022\/07\/How-Hotlinking-Affects-Your-Website-620x354.jpg 620w\" sizes=\"auto, (max-width: 970px) 100vw, 970px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]Some go so far as to compare hotlinking with theft. That hotlinking is illegal is not always correct, though: it may be that the hotlinked content is in the public domain, for instance. However, <strong>it may constitute copyright infringement<\/strong>.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]Say you are hosting an image on your website. And say that you have created said image, and want to keep it exclusive for your website. In that case, a website hotlinking to it likely violates your copyright. Worse still, say you have paid to use the image on your website, and another hotlinks to it. You have then effectively made exclusive content available to people who did not pay for it, effectively <strong>costing you money<\/strong>.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]But it\u2019s not just about exclusive content. Hotlinking is <strong>a drain on server resources<\/strong> as well. If your content is hotlinked by a high-volume website, your regular visitors might find it unavailable, as if targeted by a <a href=\"https:\/\/qodeinteractive.com\/magazine\/how-to-protect-your-wordpress-website-from-ddos-attacks\/\">DDoS attack<\/a>. Worse still, your own host might suspend your website in order to deal with unexpected traffic, or insist on charging you more for it. And all the while whatever monetization scheme you have going on isn\u2019t bringing you anything extra, in spite of more people viewing your content.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]So, at the very worst, hotlinking hurts your bottom line. At the very best, your host gets more traffic while your website gets no new visitors.<br \/>\n[\/vc_column_text][vc_empty_space height=&#8221;68px&#8221;][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]<\/p>\n<h2 class=\"qodef-h4\"><a id=\"how-to-prevent-hotlinking\"><\/a>How to Prevent Hotlinking<\/h2>\n<p>[\/vc_column_text][vc_empty_space height=&#8221;21px&#8221;]<div class=\"qodef-single-image-holder    \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"970\" height=\"554\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2022\/07\/How-to-Prevent-Hotlinking.jpg\" class=\"attachment-full size-full\" alt=\"How to Prevent Hotlinking\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2022\/07\/How-to-Prevent-Hotlinking.jpg 970w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2022\/07\/How-to-Prevent-Hotlinking-300x171.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2022\/07\/How-to-Prevent-Hotlinking-768x439.jpg 768w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2022\/07\/How-to-Prevent-Hotlinking-620x354.jpg 620w\" sizes=\"auto, (max-width: 970px) 100vw, 970px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]There are several steps you can take to prevent hotlinking, should you want to prevent other people from piggybacking off your content. We will discuss them in turn.[\/vc_column_text][vc_empty_space height=&#8221;72px&#8221;][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]<\/p>\n<h3 class=\"qodef-h5\">Choose a CDN Carefully<\/h3>\n<p>[\/vc_column_text][vc_column_text]CDN stands for Content Delivery Network. There is a lot we could say about <a href=\"https:\/\/qodeinteractive.com\/magazine\/what-is-a-cdn\/\">how CDNs work<\/a> and what good they are, but the principle is simple enough: a network of servers whose primary purpose is to reduce latency, or server response time by serving different users the same content from a variety of servers.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]If you are using a CDN \u2013 and there is no reason not to, if you can afford it \u2013 <a href=\"https:\/\/qodeinteractive.com\/magazine\/best-wordpress-cdn-services\/\">choose your CDN provider<\/a> carefully. Specifically, <strong>choose a CDN with a hotlinking prevention mechanism<\/strong> in place.[\/vc_column_text][vc_empty_space height=&#8221;72px&#8221;][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]<\/p>\n<h3 class=\"qodef-h5\">Disable Hotlinking on Apache<\/h3>\n<p>[\/vc_column_text][vc_column_text]If your website is running on Apache, you can make some changes to your <a href=\"https:\/\/qodeinteractive.com\/magazine\/find-htaccess-file-on-wordpress-site\/\"><em>.htaccess<\/em> file<\/a> in order to <strong>prevent hotlinking while allowing crawling<\/strong>. Simply locate your .htaccess file and add the following code to it:[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">RewriteEngine on\r\nRewriteCond %{HTTP_REFERER} !^$\r\nRewriteCond %{HTTP_REFERER} !^http(s)?:\/\/(www\\.)?yourwebsite.com [NC]\r\nRewriteCond %{HTTP_REFERER} !^http(s)?:\/\/(www\\.)?google.com [NC]\r\nRewriteCond %{HTTP_REFERER} !^http(s)?:\/\/(www\\.)?yahoo.com [NC]\r\nRewriteCond %{HTTP_REFERER} !^http(s)?:\/\/(www\\.)?bing.com [NC]\r\nRewriteRule \\.(jpg|jpeg|png|gif|svg)$ http:\/\/myimage.jpg [NC,R,L]<\/pre>\n<p>[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]This code will <strong>allow your website to be crawled by bots from whitelisted domains<\/strong>: Google, Yahoo, and Bing, in our case. This allows them to store thumbnail versions of images from your website in order to include them in rich results. You can use the same code to allow other search engines to do the same.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]Of course, you need to replace<em> yourwebsite.com<\/em> with your website URL. The final line of the code given here can be omitted, but the URL in it can be used to point to a placeholder image given instead of the content the hotlinker wants to hotlink to.[\/vc_column_text][vc_empty_space height=&#8221;72px&#8221;][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]<\/p>\n<h3 class=\"qodef-h5\">Check Your Settings<\/h3>\n<p>[\/vc_column_text][vc_column_text]Your <strong>hosting account may provide settings<\/strong> which disallow hotlinking for your website. You may need to consult your hosting provider if that is the case. If your website is running on Apache and you are confident in your ability to edit the <em>htaccess<\/em> file, you can consult the section above, but other hosting providers may have other options available.[\/vc_column_text][vc_empty_space height=&#8221;72px&#8221;][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]<\/p>\n<h3 class=\"qodef-h5\">Disable Right Click<\/h3>\n<p>[\/vc_column_text][vc_column_text]While this is not fully effective, you can <a href=\"https:\/\/qodeinteractive.com\/magazine\/how-to-disable-right-click-wordpress\/\">disable right clicking<\/a> on your WordPress website. This <strong>will not prevent most people<\/strong> who are really bent on stealing your content, but it will make it difficult for them. They will not be able to copy an image or its URL with ease and link it on their website, for instance.[\/vc_column_text][vc_empty_space height=&#8221;72px&#8221;][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]<\/p>\n<h3 class=\"qodef-h5\">Rename Files<\/h3>\n<p>[\/vc_column_text][vc_column_text]A <strong>quick fix<\/strong> which you can use at a pinch is simply to <strong>rename your media files<\/strong>. The file name is an important part of the URL. Change the file names and links on your website, and the hotlinking websites will not be able to use your content, throwing up <a href=\"https:\/\/qodeinteractive.com\/magazine\/404-not-found-wordpress-error\/\">404 errors<\/a>. To be fair, this is <strong>a pedestrian method<\/strong>: it is time-consuming to change a large number of file names and their links on other pages of your website. Not to mention that file name changes can affect your SEO: you want a media file to have a logical name.[\/vc_column_text][vc_empty_space height=&#8221;68px&#8221;][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]<\/p>\n<h2 class=\"qodef-h4\">In Conclusion<\/h2>\n<p>[\/vc_column_text][vc_column_text]As you can see, hotlinking is not something you should be cavalier about tolerating. There are some easy steps you can take to prevent hotlinking, and most of them require a quick change to your settings. So, safeguard your resources and protect your bottom line: now you know how.<br \/>\n[\/vc_column_text][\/vc_column][\/vc_row]<\/p>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>Safeguard your website&#8217;s resources: prevent hotlinking on your WordPress website. We will show you how it&#8217;s done.<\/p>\n","protected":false},"author":16990,"featured_media":39535,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[163,4,13],"class_list":["post-39521","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-resources","tag-performance","tag-tips","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/posts\/39521","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/users\/16990"}],"replies":[{"embeddable":true,"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/comments?post=39521"}],"version-history":[{"count":0,"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/posts\/39521\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/media\/39535"}],"wp:attachment":[{"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/media?parent=39521"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/categories?post=39521"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/tags?post=39521"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}