Deckard
Deckard

Reputation: 1433

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

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?

Upvotes: 0

Views: 187

Answers (1)

covener
covener

Reputation: 17886

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.

Upvotes: 0

Related Questions