+1 vote
in Web & Google by (77.2k points)
I am currently using Apache/2.4.57 on my web server. Recently, I found that it gives a 403 error if the URI query string contains a space. The error message in the domain's error.log is "AH10411: Rewritten query string contains control characters or spaces." It seems that the new version of Apache does not allow spaces in the query string.

How can I fix this issue?

1 Answer

+1 vote
by (354k points)
selected by
 
Best answer

You can fix the issue by modifying the ".htaccess" file of your domain. Open the ".htaccess" file in an editor and search for "RewriteRule". You need to add the [B] flag (escape backreferences) to fix the issue. The [B] flag instructs RewriteRule to escape non-alphanumeric characters before applying the transformation. Thus, your server will not return 403 error even if space is in the query string.

Here is an example to show how to add the [B] flag.

RewriteRule . %1/%2 [B,R=301,L]


...