Précisions sur une RewriteCond pour retour 403 sur un fichier php
Bonjour,
j'utilise un fichier get.php dans un dossier publié qui lit et retourne une image jpg depuis un dossier non publié. Je l'utilise de la sorte :
Code:
<img src="get.php?img=12">
Pour bloquer l'accès direct au fichier get.php j'ai ajouté ce .htaccess :
Code:
1 2 3 4
| RewriteEngine on
RewriteCond %{HTTP_REFERER} !http://localhost/.* [NC]
RewriteCond %{HTTP_REFERER} !localhost/.* [NC]
RewriteRule ^get.php$ - [F] |
Ça retourne une erreur 403 si on essaie d'accéder à http://localhost/get.php donc ça fonctionne. Mais en fait j'aimerais bien comprendre pourquoi ça ne retourne par une erreur 403 lors de l'appel à <img src="get.php?truc=12"> ?
Le navigateur client fait bien un GET http://localhost/get.php lorsqu'il passe sur la balise image non ?
D'autre part, que pensez-vous de ce type de "protection" pour restreindre l'accès aux images ?
Merci d'avance.