使用的.htaccess阻止所有的域来访问图像文件夹中除myown域 [英] Use .htaccess to block all domains to access images folder except myown domain

查看:147
本文介绍了使用的.htaccess阻止所有的域来访问图像文件夹中除myown域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用.htacess,以阻止所有的域来访问我的图片文件夹。 这个文件夹只有通过唯一的自己的域名进行访问。

i want to use .htacess to block all domains to access my images folder. this folder is only accessible by own domain only.

推荐答案

作为的阿帕奇文档的这个页面,你可以用下面的指令完成它,将例如\ .COM 您正在访问的域名(请记住从逃避任何点的字符 \

As described in this page of Apache docs, you can accomplish it with the following directives, replacing example\.com with your domain name (please remember to escape any dot characters from . to \.:

SetEnvIf Referer example\.com localreferer
<FilesMatch \.(jpe?g|png|gif)$>
Order deny,allow
Deny from all
Allow from env=localreferer
</FilesMatch>

这篇关于使用的.htaccess阻止所有的域来访问图像文件夹中除myown域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆