基本的に、Apacheディレクトリ内のすべてのファイルは、イメージ以外はアクセスできません。画像はアクセス可能でなければなりませんが、ウェブサイトからロードされた場合に限ります。 Refererに基づいてApacheルールを設定すると、パスするのが非常に簡単です:http://www.mustap.com/phpzone_post_62_how-to-bypass-the-referer-se もちろん正しい選択ではありません。イメージのApacheディレクトリとセキュリティ
私のApacheのconfファイル:
<Directory /var/www/path>
Order allow,deny
Deny from all
Options -Indexes
# Check against the referer, first level check
SetEnvIf Referer domain1\.com domain1
SetEnvIf Referer domain1\.com domain2
<FilesMatch \.(jpg|jpeg|gif|png)$>
Order deny,allow
Deny from all
Allow from env=domain1
Allow from env=domain2
</FilesMatch>
</Directory>
どのように私は、DB内の画像を入れずにこの問題を解決することができますか?確実に知るために
おかげ
注意:site.com/image.php?name=../../../etc/passwd;) – ZiTAL
ありがとう!私もこのリンクを見つけたので便利です: http://michael.theirwinfamily.net/articles/csshtml/protecting-images-using-php-and-htaccess – Daviddd