54.215.234.39 - - [02/Apr/2014:10:51:35 -0400] "GET /ProductSearch.aspx?qs=94307 HTTP/1.1" 404 11414 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0"
I am getting a lot of these requests sent to my apache server from various ip addresses. We used to use a aspx based site. Now it's php. These requests are flooding the server. How can I block all requests that have the string "ProductSearch.aspx" in them?
Best Answer
You could send a
403 Forbidden
(access denied) in case/ProductSearch.aspx
is requested :However, note that these requests will still reach your server and will appears in your
access.log
(but with a403
instead of a404
).To avoid this you will have to filter before your web server. This could be done with a Reverse Proxy but this is a full other point.
Also, as mentionned by @Michael Hampton in comments, you could redirect all requests that ask for an
*.aspx
file to an*.php
page.(assuming, e.g, that
yourpage.aspx
has been replaced byyourpage.php
) :This will redirect
http://mydomain.com/ProductSearch.aspx?qs=94307
to
http://mydomain.com/ProductSearch.php?qs=94307