【发布时间】:2011-06-10 03:38:28
【问题描述】:
在我们基于 ZF 的站点中,如果 url 在控制器/动作段上包含 $$$ 或 ~,则不会被捕获为 404 错误,相反,它们会在没有符号的情况下登陆控制器/动作,但是当它尝试加载视图脚本,但视图脚本文件仍然有这些符号,从而导致错误。
例如:
site.com/index$$$
script 'index$$$/index.phtml' not found in path
site.com/index-$$$
script 'index-$$$/index.phtml' not found in path
site.com/index~
script 'index~/index.phtml' not found in path
site.com/index/index~
script 'index/index~.phtml' not found in path
它们必须被捕获为 404 错误,如果控制器/操作不存在,则外站可以捕获 404 错误。
ex: /badurl$$$, /non/existing~
例子:http://framework.zend.com/index.$$$/index~
是否有任何现有问题/解决方案?
提前致谢!
PS:我们仍在使用 ZF 1.0.3,但这也会影响 1.8.2 中的其他网站。
更新:这是.htaccess的内容
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_URI} ^/search$
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule . /search/?%1 [R=301,L]
# Redirect all https urls to http
# These are the pages excluded on the redirection
RewriteCond %{SERVER_PORT} ^443$
RewriteCond %{REQUEST_URI} !^/minify/.*
RewriteCond %{REQUEST_URI} !^/myaccount/.*
RewriteCond %{REQUEST_URI} !^/akamai/.*
RewriteCond %{REQUEST_URI} !^/navigation/.*
RewriteCond %{REQUEST_URI} !^/cache/.*
RewriteCond %{REQUEST_URI} !^/includes/.*
RewriteCond %{REQUEST_URI} !^/images/.*
RewriteCond %{REQUEST_URI} !^/pdf/.*
RewriteCond %{REQUEST_URI} !^/index.php
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [R=301,L]
######################################################
# if non-PHP file is requested, display the file #
RewriteRule \.(js|ico|txt|gif|jpg|png|css|xml|swf|zip|pdf|gz)$ - [L,NC]
# if PHP file is requested and it exists, display the file #
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule \.php$ - [L]
# redirect everything else to controller #
RewriteCond %{REQUEST_URI} !^/server-status.*
RewriteRule .+$ index.php [L]
# Disable Etags
FileETag none
【问题讨论】:
-
你的重写规则是什么?采埃孚 1.0.3?该死的。
-
更新帖子以包含重写规则。
-
我重新阅读了您的帖子。如果控制器被正确调用,但视图脚本不是,听起来你的 PHP 实际上是错误的。你如何设置视图脚本路径?
标签: zend-framework url