Php url中出现%1时出现htaccess错误400

Php url中出现%1时出现htaccess错误400,php,mod-rewrite,Php,Mod Rewrite,如果我尝试访问,此htaccess将返回错误400 test.php: Options +FollowSymLinks -MultiViews RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-l RewriteCond %{REQUEST_FILENAME} !-d RewriteRule (?!^infos/)^(.+?)/?$ /test

如果我尝试访问,此htaccess将返回错误400

test.php:

Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (?!^infos/)^(.+?)/?$ /test.php?f=$1 [L,QSA,NC]
结果:

echo $_SERVER['QUERY_STRING'];
如何在htaccess中转义%符号?
是否还有其他字符会导致相同的问题?

要在mod_rewrite中转义%s,可以使用
B
标志。它用于转义非字母数字字符。如果对你有效,请告诉我

e、 g


看看伟大的jdMorgan对您的问题的回答:好的,那么我可以使用htaccess将%替换为XYZ吗?所以如果我收到一个请求,它会重定向到
f=error/400.html
RewriteRule (?!^infos/)^(.+?)/?$ /test.php?f=$1 [B,L,QSA,NC]