Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
「.ru」などの特定のトップ レベル ドメインから要求された場合に、サイトからの画像へのアクセスを htaccess でブロックする方法はありますか?
私は現在使用しています:
RewriteCond %{HTTP_REFERER} ^\.ru [NC,OR] Rewriterule ^(.*)$ https://www.google.com/images/srpr/logo4w.png [r=307,NC]
しかし、意図したとおりに機能するとは思わない..
ありがとう!
使用している正規表現は、「で始まるもの^\.ru」を意味するため、リファラーがである場合、明らかに一致しません。試す:.ruhttp://some-site.ru/some-path/some-page.html
^\.ru
.ru
http://some-site.ru/some-path/some-page.html
RewriteCond %{HTTP_REFERER} ^https?://[^/]+\.ru/? [NC]