我有以下.htaccess
文件:
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/command
RewriteRule .* /command/rewritehandler.php?q=%{REQUEST_URI} [B]
查看当前未回答的问题https://stackoverflow.com/questions/29376788/mod-rewrite-directives-and-valid-invalid-utf-8-characters-after-first-character的规格。
如果向服务器请求以下/aaa%23%23aa
,则rewritehandler.php
仅收到/aaa
。看起来REQUEST_URI
仅处理%23
之前的数据。我应该输入什么呢?
答案 0 :(得分:1)
从RewriteCond
捕获值,然后使用反向引用使其正常工作:
RewriteEngine On
RewriteCond %{REQUEST_URI} (.+)
RewriteRule !^command/ /command/rewritehandler.php?q=%1 [NC,B,L,QSA]