【发布时间】:2012-02-25 14:28:05
【问题描述】:
我使用的是标准 Zend /public/.htaccess 文件(如下所示)。
目前我正尝试将用户转发到特定的控制器/动作,并提供成功重定向 URL 作为 URL 参数。
生成的 URL(通过 Zend 的 URL 视图助手组装和编码)如下所示:
localhost/crop/index/successRedirect/localhost%2Fprofile%2Fbasic
但是这种模式显然违反了 Zend 包 mod_rewrite 的默认规则:访问 URL 会产生标准的 Apache 404 错误; Zend 没有收到请求。
当最终参数手动重新形成如下时,请求按预期工作:
localhost/crop/index/?successRedirect=localhost%2Fprofile%2Fbasic
但是,这需要一个骇人听闻的两步 URL 生成过程。如果视图助手生成的 URL 独立工作,那将是理想的。
可以做些什么来允许 url 编码通过?任何见解将不胜感激!
这些是我的 .htaccess 的内容
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
像这样启用 RewriteLog 不会产生失败模式的输出:
RewriteLogLevel 9
RewriteLog "<path>/rewrite.log"
我尝试了以下两个问答中提出的解决方案,没有任何变化:
-
Adding encoded chars to the url breaks htaccess (
AllowEncodedSlashes On) -
Mod Rewrite and Using PHP's GET for URL's When not Following the Rules(使用
QSA指令重写规则)
【问题讨论】:
-
这个提议的解决方案也没有效果:stackoverflow.com/questions/6520484/… - 将
NE指令添加到RewriteRule
标签: zend-framework .htaccess mod-rewrite url-rewriting urlencode