RewriteRule
to escape non-alphanumericcharacters before applying the transformation.[B=#?;]
. Note: The spacecharacter can be used in the list of characters to escape, but it cannot bethe last character in the list.mod_rewrite
has to unescape URLs before mapping them,so backreferences are unescaped at the time they are applied.Using the B flag, non-alphanumeric characters in backreferenceswill be escaped. For example, consider the rule:search.php?term=x%20&y%2Fz=
, which is not what was intended./search.php?term=x%20%26%20y%2Fz
.AllowEncodedSlashes
to On
to get thisparticular example to work, as httpd does not allow encoded slashes in URLs, andreturns a 404 if it sees one.RewriteCond
to capture against %{THE_REQUEST} which will capturestrings in the encoded form.