Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess 用html代码替换热链接图像_.htaccess_Hotlinking - Fatal编程技术网

.htaccess 用html代码替换热链接图像

.htaccess 用html代码替换热链接图像,.htaccess,hotlinking,.htaccess,Hotlinking,我发现我的一个竞争对手复制了我的网页,并在这个过程中在他的网页上热链接了一个图像——他可能只是从浏览器中复制/粘贴了一个图像。 我知道如何处理热链接,但我想尝试一个更好的版本:我想使用htaccess用html代码替换他的页面上的,所以当他的页面使用html时 <img src="http://www.mysite.invalid/image.jpg" /> 将由 dontstealbandwidth.jpg"/> this image steals bandwidth

我发现我的一个竞争对手复制了我的网页,并在这个过程中在他的网页上热链接了一个图像——他可能只是从浏览器中复制/粘贴了一个图像。 我知道如何处理热链接,但我想尝试一个更好的版本:我想使用htaccess用html代码替换他的页面上的,所以当他的页面使用html时

<img src="http://www.mysite.invalid/image.jpg" /> 

将由

dontstealbandwidth.jpg"/> this image steals bandwidth from <a href="http://mysite.invalid">mysite.invalid</a><img src="dontstealbandwidth.jpg
dontstealbandwidth.jpg/>此图像从
他的页面中的结果将是

<img src="http://www.mysite.invalid/dontstealbandwidth.jpg"/> this image steals bandwidth from <a href="http://mysite.invalid">mysite.invalid</a><img src="dontstealbandwidth.jpg" />
此图像从中窃取带宽
我试图将图像重定向到html文件。直接访问我网站上的图像将显示html文件的内容。但是,这似乎对html代码中的图像不起作用。 这有可能吗?感觉不应该是这样,但如果是这样的话会很酷。
可以这样做吗?

当浏览器请求图像数据时,您无法返回HTML文本作为响应。当然,您可以使用简单的方法创建名为
/dontstealbandwidth.jpg
的自定义图像,并将HTML文本嵌入其中,然后将
/image.jpg
重定向到
/dontstealbandwidth.jpg
重定向规则如下:

RedirectMatch 301 ^/image\.jpg$ /dontstealbandwidth.jpg

当浏览器请求图像数据时,您不能返回HTML文本作为响应。当然,您可以制作一个名为
/dontstealbandwidth.jpg
的自定义图像,并将HTML文本嵌入其中,然后使用如下简单的重定向规则将
/image.jpg
重定向到
/dontstealbandwidth.jpg

RedirectMatch 301 ^/image\.jpg$ /dontstealbandwidth.jpg

您好,我非常了解这一点,但我想在代码中嵌入指向我的站点的超链接。这对于图像afaikhi是不可能的,我非常了解,但我想在代码中嵌入指向我的站点的超链接。对于图像afaik是不可能的