如何避免 Zend Framework 中的index.php?
我正在使用 Zend Router,所以像 (/ 和 /index.php) 或 (/about 和 /index.php/about) 这样的东西在这里最终是一样的。
但是, /index.php/whatever 不应该存在,因为它与 /whatever 是完全相同的资源,因此重复没有意义。
我该如何避免这种情况?
甚至 http://zendframework.com/manual/en/zend.controller.router .html 和 http://zendframework.com /index.php/manual/en/zend.controller.router.html 都存在。根本没有任何意义...
I'm using the Zend Router and so things like (/ and /index.php) or (/about and /index.php/about) ends up as the same here.
However, /index.php/whatever should not exist as it is the exactly same resource as /whatever so it doesn't make a sense the duplication.
How do I avoid this?
Even http://zendframework.com/manual/en/zend.controller.router.html and http://zendframework.com/index.php/manual/en/zend.controller.router.html both exists. It doesn't make any sense at all...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
1)不要链接到它(就像你问题中的网址)并让它成为一个隐藏功能。基本上没关系。
或
2) 添加重写规则,从包含
/index.php
的任何请求中删除它。您必须确保将其转发到index.php
以便您仍然可以处理它,并且您可能想要发送 以 3 开头的状态代码。1) Don't link to it (like the urls in your question) and let it be a hidden feature. It won't matter, basically.
or
2) Add a rewrite-rule to strip out
/index.php
from any request containing it. You have to be sure to forward it toindex.php
so that you still can handle it, and you probably want to send a status code beginning with 3.似乎您的
mod_rewrite
配置不正确(Apache 中是否启用了mod_rewrite
?.htaccess 配置是否正确?
)。如果是这样,您根本不必输入index.php
。编辑:
Seems that your
mod_rewrite
is not configured properly (ismod_rewrite
enabled in Apache? Is.htaccess configured properly?
). When it would be, you wouldn't have to typeindex.php
at all.Edit: