简体   繁体   English

想使用重写模块阻止 apache 中的特定 URL 模式

[英]want to block specific URL pattern in apache using rewrite module

I see some traffic burst on my apache with all invalid URLs but with a specific pattern.我看到我的 apache 上出现了一些流量突发,其中包含所有无效的 URL,但具有特定的模式。 Below are the some URLs下面是一些网址

www.example.com/?1gx2A1WV=Ji7iMHhDsDOHvesb8 www.example.com/?1gx2A1WV=Ji7iMHhDsDOHvesb8

www.example.com/?LTn28PGXpg=VQTNObTmrhyF7Pjs2VoX www.example.com/?LTn28PGXpg=VQTNObTmrhyF7Pjs2VoX

So basically I want to block this pattern in apache.所以基本上我想在 apache 中阻止这种模式。 anything that has "?"任何有“?”的东西after www.example.com/ should be blocked.在 www.example.com/ 之后应该被阻止。

Can someone please help me creating RewriteRule in apache for this.有人可以帮我在 apache 中为此创建 RewriteRule。 Thanks in advance.提前致谢。

REQUEST_URI does not contain query string. REQUEST_URI 不包含查询字符串。 Try matching your rule against QUERY_STRING尝试将您的规则与 QUERY_STRING 匹配

This should help.这应该有帮助。 RewriteCond matches the pattern you have mentioned for request uri. RewriteCond 匹配您为请求 uri 提到的模式。 Rewrite Rule sends back 403 as HTTP Response.重写规则将 403 作为 HTTP 响应发回。 Your use of Location may vary based on your apache configuration.您对 Location 的使用可能会因您的 apache 配置而异。

<Location />
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/\?.*$ 
RewriteRule ^.*$ - [F,L]
</Location>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM