


I won’t go into details about the significance of anti-hotlink pictures on websites! For details, please refer to the article on this site: How to use .htaccess to prevent hotlinking website images. This article mainly shares how to use .htaccess to prevent hotlinking only for pictures in a certain directory of the website.
When we used .htaccess to prevent hotlinking website images in the past, we placed the file that replaced the hotlinked image under the root directory of the website. However, the directory planning of the website rarely placed the image file in the root of the website. directory. This leads to a problem. If the file is not stored in the root directory and is set according to the previous setting method, the anti-hotlink replacement image we set will also be protected against hotlinking. The final result of this is that when others hotlink our pictures, the anti-hotlinking rules of our website will fall into an infinite loop and eventually display a cross.
So what should we do about this problem? At this time, the best way is to adjust the rules to prevent hotlinking for a certain directory on the website. Generally, the pictures uploaded by the website will be stored in a fixed folder. Now that we understand this problem, let’s use an example to illustrate how to set up anti-hotlinking rules for only a certain directory.
RewriteEngine On RewriteBase / RewriteCond %{HTTP_REFERER} !^$ [NC] RewriteCond %{HTTP_REFERER} !phpernote.com [NC] RewriteCond %{HTTP_REFERER} !google.com [NC] RewriteCond %{HTTP_REFERER} !baidu.com [NC] RewriteCond %{HTTP_REFERER} !sogou.com [NC] RewriteCond %{HTTP_REFERER} !soso.com [NC] RewriteCond %{HTTP_REFERER} !youdao.com [NC] RewriteCond %{HTTP_REFERER} !yahoo.cn [NC] RewriteRule ^uploadfiles/(.*)\.(gif|jpg|png)$ http://www.phpernote.com/images/change.gif [L]
There is no explanation for the above sentences. If you don’t understand, you can refer to: Use .htaccess to prevent hotlinking website pictures for explanation. The last sentence of this code is the highlight. What this means is that the anti-hotlink setting is only for all gif jpg png pictures in the uploadfiles directory in the root directory. All hotlinked pictures in this directory will display the change.gif file in the images directory in the root directory.
Articles you may be interested in
- How to use .htaccess to prevent hotlinking website images
- Set the default homepage of the website through .htaccess
- Use .htaccess ban list directories
- Use Apache’s htaccess to prevent images from being linked to theft
- How to set the jump waiting time for thinkphp page jump (successerror)
- How to pass. htaccess to change the default homepage of the website?
- Js address bar special effects (displays the size of all linked images on the page and the height of the current browser)
- Use .htaccess to deny certain IP access to the website

网上下载的 pdf 学习资料有一些会带有水印,非常影响阅读。比如下面的图片就是在 pdf 文件上截取出来的,今天我们就来用Python解决这个问题。安装模块PIL:Python Imaging Library 是 python 上非常强大的图像处理标准库,但是只能支持 python 2.7,于是就有志愿者在 PIL 的基础上创建了支持 python 3的 pillow,并加入了一些新的特性。pip install pillow pymupdf 可以用 python 访问扩展名为*.pdf、

随着互联网的普及,越来越多的网站提供了图片、视频等资源的外链功能。然而,这种外链功能却容易被盗链。盗链是指其它网站利用你网站上的图片、视频等资源,直接通过引用地址在自己的网站显示这些资源,而不是将其下载到自己的服务器上。这样一来,盗链网站就可以免费使用你网站的流量和带宽资源,这既浪费资源又影响网站速度。针对这种问题,可以使用Nginx进行防盗链。Nginx是

PHP和GD库实现图片裁剪的方法概述:图片裁剪是网页开发中常见的需求之一,它可以用于调整图片的尺寸,剪裁不需要的部分,以适应不同的页面布局和展示需求。在PHP开发中,我们可以借助GD库来实现图片裁剪的功能。GD库是一个强大的图形库,可提供一系列函数来处理和操控图像。代码示例:下面我们将详细介绍如何使用PHP和GD库来实现图片裁剪。首先,确保你的PHP环境已经

在网页开发中,图片预载是一种常见的技术,可以提升用户的体验感。当用户浏览网页时,图片可以提前下载并加载,减少图片加载时的等待时间。在Vue框架中,我们可以通过一些简单的方法来实现图片预载。本文将介绍Vue中的图片预载技术,包括预载的原理、实现的方法和使用注意事项。一、预载的原理首先,我们来了解一下图片预载的原理。传统的图片加载方式是等到图片全部下载完成才显示

此前,PS的重建图像功能就让人无比振奋,让无数人惊呼今天,StabilityAI又放大招了。它联合Clipdrop推出了UncropClipdrop——一个终极图像比例编辑器。从Uncrop这个名字上,我们就能看出它的用途。它是一个AI生成的「外画」工具,通过创建扩展背景,这个工具可以补充任何现有照片或图像,来更改任何图像的比例。敲黑板:通过Clipdrop网站,就可以免费试用这个工具了,无需登录!比例任意调,满意为止Uncrop基于StabilityAI的文本到图像模型StableDiffus

vue报错找不到图片的解决办法:1、修改配置文件,将绝对路径改为相对路径;2、将图片作为模块加载进去,并将图片放到static目录下;3、将imageUrls引入响应的vue文件中,解析引用即可。

Gin框架是一款流行的用于构建Web应用程序的Go语言框架。随着网络的发展,防盗链和热链保护成为了Web应用程序开发中的必要功能。在本文中,我们将详细介绍如何在Gin框架中实现防盗链和热链保护。什么是防盗链和热链?防盗链和热链是指通过某个网站访问到的资源在未经许可的情况下被其他网站直接链接使用的行为。这种行为被称为盗链或热链。盗链和热链都会给网站带来不必要的

如何在uniapp中实现图片滤镜效果在移动应用开发中,图片滤镜效果是一种常见且受用户喜爱的功能之一。而在uniapp中,实现图片滤镜效果也并不复杂。本文将为大家介绍如何通过uniapp实现图片滤镜效果,并附上相关代码示例。导入图片首先,我们需要在uniapp项目中导入一张图片,以供后续滤镜效果的处理。可以在项目的资源文件夹中放置一张命名为“filter.jp


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

SublimeText3 Chinese version
Chinese version, very easy to use

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Dreamweaver CS6
Visual web development tools
