如何停止在其他网站上使用我的图片?

How can I stop the use of my images on another website?

假设我在我的服务器 (www.myserver.com) 上显示我的图像,如下所示:

<img src='http://www.myserver.com/users/images/example.jpg' alt='example' />

应该显示上面的图像,因为它在我的服务器上,但如果相同的 html 由不同的主机提供,例如:www.otherserver.com - 我不想显示图片。

任何人都可以详细说明如何解决这个问题吗?

我认为你可以使用 http-server(nginx 或其他)来解决你的问题 您可以创建新的路由,例如:

location ~* ^.+\.(jpg|jpeg|gif|png)$ {
    valid_referers none blocked www.myserver.com myserver.com;
    if ($invalid_referer) {
        return 403;
    }
}

nginx 文档 - http://nginx.org/en/docs/http/ngx_http_referer_module.html#valid_referers

如果您使用的是 apache,那么您可以通过 htaccess 停止热链接。 请参阅此处是完整的指南。 http://altlab.com/htaccess_tutorial.html