create 301 redirection using .htaccess

Hotlink Protection means protection of your static files from being linked directly. By enabling hotlink protection one can save server bandwidth. .htacess is being widely used to tweak configuration settings of Apache Web Servers. It can also be used to enable hotlink protection of your Website. Let’s learn how to enable hotlink protection using .htaccess.

How to enable hotlink protection using .htaccess

STEP 1: Open your .htaccess on an editor. Add the below codes in it.

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_REFERER}!^https://(.+\.)?yourwebsite\.com/[NC]
RewriteCond %{HTTP_REFERER}!^$
RewriteRule .*\.(jpg|jpeg|gif|bmp|png|swf)$-[F]

Note: Replace yourwebsite.com with the original domain name. Check whether your files can be hotlinked or not.

  • Was this article Helpful ?
  • yes   no

Comments

  1. FirstCurt

    I see you don’t monetize your site, don’t waste your traffic, you can earn additional bucks every
    month because you’ve got high quality content. If you want to know how to make extra money, search for: Mrdalekjd methods for $$$

Leave a Reply