Apache RedirectMatch, ErrorDocument .etc doesn't work for the unsual query string

怎甘沉沦 提交于 2019-12-11 23:55:45

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!