How To Prevent Website From Hotlinking on Apache Server

Guide to prevent hotlinking images on Apache server

Hotlinking is the process of stealing someone’s website bandwidth by directly adding assets from one website to another. These assets can be images, videos, or audio. The other websites embed your images, videos and audio by copying the HTML code.

If your website is hosted on an Apache server then you can follow these simple steps to enable hotlink protection on an Apache server is easier than you might think.

Open the .htaccess file in your root directory of the Apache server and add the following code:

RewriteEngine on

RewriteCond %{HTTP_REFERER} !^$

RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?yourdomain.com [NC]

RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?google.com [NC]

RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?bing.com [NC]

RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?yahoo.com [NC]

RewriteRule \.(jpg|jpeg|png|gif|svg)$ https://dropbox.com/hotlink-placeholder.jpg [NC,R,L]

People Also Like

  • Domain Transfer from Mitsu.in

    Need more better domain registrar than Mitsu I’ve few domains registered with Mitsu (mitsu.in) an Indian domain registrar for .in domains. Got poor customer service…

  • SimpCity Forums

    Why SimpCity forums site is down? I’m fan of SimpCity and their website simpcity.cr seems to be down. Has it been under ddos attack? I…

  • Best Managed WordPress Hosting Provider

    Looking for managed wordpress hosting services better than WP Engine After Automattic stopped WP Engine from updating themes and plugins my site can’t get further…

  • VPS Hosting Coupons and Offers

    Need to buy VPS hosting plan. Any coupon code? A friend (fellow reddit user) of mine recommended me to buy VPS from The-Online.com in their…

  • Cheap Flights Booking Domain Needed

    Want to buy domain name for cheap flights booking I am considering to start a new website which offers flight booking, basically a service to…