Knowledge base

1000 FAQs, 500 tutorials and instructional videos. Here, there are only solutions!

Fix a hotlinking issue

Update 02/23/2026

This guide helps you protect your resources against hotlinking on your Infomaniak Web Hosting.

 

Preamble

  • Hotlinking occurs when a third-party site displays your images, videos, or music by directly using the URL of your server; the remote site uses your resources and server power at your expense, often without citing the source.
  • Although bandwidth is more generous today, hotlinking remains a problem for protecting your copyrights and avoiding unnecessary overloading of your server.

 

Prevent hotlinking via .htaccess

You can block these unauthorized accesses by adding rules to the .htaccess file at the root of your site. Here is an optimized version including modern image formats (WebP, AVIF):

RewriteEngine on

# 1. Autoriser les requêtes avec un Referer vide (certains navigateurs pour la vie privée)
RewriteCond %{HTTP_REFERER} !^$

# 2. Autoriser votre propre site (remplacez par votre domaine)
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?votre-domaine\.com [NC]

# 3. AUTORISER LES MOTEURS DE RECHERCHE (Indispensable pour votre SEO)
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?google\. [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?bing\. [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?yahoo\. [NC]

# 4. Bloquer le hotlinking (renvoie une erreur 403 Forbidden)
RewriteRule \.(jpg|jpeg|png|gif|svg|webp|avif)$ - [F,NC,L]

Recommendations:

  • Replace: change your-domain\.com with your actual domain name.
  • SEO: only remove the Google/Bing lines if you intentionally want your images to never appear in search results.
  • Alternative 403: the rule above uses [F] (Forbidden). This is more ecological and performant than loading a replacement image that still consumes bandwidth.
Tip: If you use a CDN like Cloudflare in front of your Infomaniak hosting, you can enable "Hotlink Protection" with one click in their management interface.

Has this FAQ been helpful?