问题
I have the following .htaccess
file:
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/command
RewriteRule .* /command/rewritehandler.php?q=%{REQUEST_URI} [B]
See specs at currently unanswered question https://stackoverflow.com/questions/29376788/mod-rewrite-directives-and-valid-invalid-utf-8-characters-after-first-character .
If request to server the following /aaa%23%23aa
then rewritehandler.php
receives only /aaa
. Looks like REQUEST_URI
only handles data before %23
. What I should type instead?
回答1:
Capture value from RewriteCond
and then use a back-reference to make it work:
RewriteEngine On
RewriteCond %{REQUEST_URI} (.+)
RewriteRule !^command/ /command/rewritehandler.php?q=%1 [NC,B,L,QSA]
来源:https://stackoverflow.com/questions/29395719/how-to-bypass-23-hash-sign-through-rewriterule-without-data-loss