Hetzner - DokuWiki

KonsoleH:Dateien vor Hotlinking schützen/en

How do I protect my files from hotlinking?

To ensure that your home page files are really only being retrieved by visitors to your site and are not being abused by third party sites the following .htaccess file may be used:

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?domain\.tld(/.*)?$ [NC]
RewriteRule \.(gif|jpg|jpeg|png|zip|mpg|GIF|JPG|JPEG|PNG|ZIP|MPG)$ - [F]

Replace domain.tld with your domain name. Add additional file endings if needed.

This is particulary useful for protecting pictures, videos or other larger files. HTML or PHP files should not be protected in this way, as otherwise it will no longer be possible to link your site.

© 2019. Hetzner Online GmbH. Alle Rechte vorbehalten.