1

I have PHP application, on Ubuntu Apache web server.

Application have search feature, as GET type of request.

After submitting search string, Apache returns 403 Forbidden error, if I have more that one word as a search string, like:

https://my-url.com/publications/index/search:nikola%20tesla/submit:Submit

But it works fine, if I have only one word as search string, like:

https://my-url.com/publications/index/search:nikola/submit:Submit

I checked Apache log files, and it logs next error in this case:

AH10411: Rewritten query string contains control character or spaces

File /app/.htaccess looks like this:

RewriteEngine on
RewriteRule    ^$    webroot/    [L]
RewriteRule    (.*) webroot/$1    [L]

File /app/webroot/.htaccess looks like this:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]

Can you help me to solve this? Tried to fix it with directives in .htaccess but no luck.

user198003
  • 11,029
  • 28
  • 94
  • 152
  • We cannot help you, unless you share your .htaccess file, so we check what the rules are there... [How to create a Minimal, Reproducible Question](https://stackoverflow.com/help/minimal-reproducible-example) – Ron Mar 15 '23 at 19:51
  • How is this URL being built? A `:` shouldn't be a delimiter for a GET request. The `:` is a control character in a URL. – user3783243 Mar 15 '23 at 19:53
  • Does this answer your Q: https://stackoverflow.com/questions/75684314/ah10411-error-managing-spaces-and-20-in-apache-mod-rewrite – Ron Mar 15 '23 at 19:54
  • I have just shared my .htaccess file, as update of a question. – user198003 Mar 15 '23 at 19:56
  • 3
    _"Rewritten query string contains control character or spaces"_ - Have you tried the `B` flag? https://httpd.apache.org/docs/2.4/rewrite/flags.html#flag_b – CBroe Mar 16 '23 at 07:27
  • The B flag actually worked in my case! Thanks @CBroe – duy Jun 13 '23 at 17:40
  • Does this answer your question? [AH10411 error: Managing spaces and %20 in apache mod\_rewrite](https://stackoverflow.com/questions/75684314/ah10411-error-managing-spaces-and-20-in-apache-mod-rewrite) – DisgruntledGoat Jul 17 '23 at 16:41

0 Answers0