Is this possible to block a requests ends with a specific url in apache, for example i have to block all the requests end with ?wsdl.
Asked
Active
Viewed 5,633 times
1 Answers
0
Your example is easy to solve, you can use mod_rewrite
to achieve this:
RewriteCond %{QUERY_STRING} "^wsdl.*$"
RewriteRule "" "-" [F]
This will block any request with wsdl
at the beginning of the first query parameter name.
To block only the wsdl
parameter anywhere in the query string, the regular expression is a bit more complicated:
RewriteCond %{QUERY_STRING} ".*(?:^|&)wsdl(?:=|&|$)"
RewriteRule "" "-" [F]
This configuration works on
- ?wsdl
- ?wsdl=something
- ?s1=s2&wsdl
- ?s1=s2&wsdl=something
- ?s1=s2&wsdl&s3=s4
Sources I've used:

Ondřej Xicht Světlík
- 301
- 1
- 7
-
Great! I'm glad I could have helped. – Ondřej Xicht Světlík Apr 10 '18 at 10:41