πŸ‡ΊπŸ‡ΈUnited States @hunmonk

Account created on 25 April 2005, over 19 years ago
#

Recent comments

πŸ‡ΊπŸ‡ΈUnited States hunmonk

Hello Drupal community! Been a long time since my last post...

Just chipping in a little more data here, because I'm facing the same issue with spaces in form autocompletes.

I was a little nervous to go with the very broad [B,L,QSA] in the rewrite, but a little further down in the doc it says this:

In 2.4.26 and later, you can limit the escaping to specific characters in backreferences by listing them: [B=#?;]. Note: The space character can be used in the list of characters to escape, but you must quote the entire third argument of RewriteRule and the space must not be the last character in the list.

# Escape spaces and question marks. The quotes around the final argument
# are required when a space is included.
RewriteRule "^search/(.*)$" "/search.php?term=$1" "[B= ?]"

As it turns out, having multiple comma-separated flags seems to suffice for the space not being the last character with this configuration, and I was able to get it to work, which is only escaping the space before applying the rewrite:

RewriteRule ^(.*)$ index.php?q=$1 "[B= ,L,QSA]"

This solves the issue w/ autocomplete, and seems a lot less likely to cause collateral damage ;)

There's also this newer directive: https://httpd.apache.org/docs/current/rewrite/flags.html#flag_bctls -- but it's only available in Apache 2.4.57 and later, and Debian Buster (still supported) is at 2.4.38

Production build 0.71.5 2024