问题
www.mysite.com/something.do?name=%25'%20and%201=1%20--
This url contains an unusual query string for security test.
Apache shows its default error page : 400 Bad Request
.
But I need to show my own error page.
I tried several things but all failed, keeps showing apache default error.
1.
ErrorDocument 400 /myErrorPage
2.
RedirectMatch --$ /myErrorPage
3.
RewriteEngine On
RewriteRule --$ /myErrorPage
4
RewriteEngine On
RewriteCond %{THE_REQUEST} --$
RewriteRule ^(.*)$ /myErrorPage
My apache version is : Server version: Apache/2.2.12 (Linux/SUSE)
.
How can I handle this unsual request url?
回答1:
Try using either a full URL or a static string in your ErrorDocument argument, those are sometimes more usable when the original request is bad because they don't require being served through the normal request processing of the server.
来源:https://stackoverflow.com/questions/21617317/apache-redirectmatch-errordocument-etc-doesnt-work-for-the-unsual-query-strin