.htaccess - 如何通过 .htaccess 使用通配符禁止主机名

标签 .htaccess

如何禁止来自 pingdomtools 的请求?

它们的主机名如下所示:

s464.pingdom.com

那么我怎样才能禁止所有以 结尾的主机名

pingdom.com

最佳答案

您可以使用重写规则。

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*tumblr\.com [NC]
RewriteRule .* - [F]
</IfModule>

http://davidwalsh.name/block-domain

  • 注意:此拦截基于引荐来源网址,引荐来源网址可能会被欺骗或完全排除。

更新:在执行反向 DNS 的服务器上,您可以尝试:

deny from .pingdom.com

https://httpd.apache.org/docs/2.0/mod/mod_access.html#allow

关于.htaccess - 如何通过 .htaccess 使用通配符禁止主机名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16761133/

相关文章:

Apache Mod_Rewrite 问号

php - Yii 2.0 静态路由 404 问题

.htaccess - Htaccess 将除主页以外的所有页面的 https 重定向到 http,将主页的 https 重定向到另一个 url

php - Htaccess 和水印

.htaccess - Vary Accept-Encoding header 不起作用

php - 如何在 PHP 中显示 Apache 默认的 404 页面

file - 试图隐藏 .htaccess 文件

php - 为什么 DirectoryIndex index.php index.html 不工作?

php - AWS Cloudfront + 负载均衡器,url 从主域更改为负载均衡器子域

facebook - 创建排除 facebook 的 301 重定向