zend 路由仅适用于小写字母
我正在 application.ini 中设置路由,因此当我尝试访问 /moved 时,它会显示 cont/move。它有效,但前提是我输入 moved
所有小写字母与第一行的设置完全相同。如何使 Moved
或 moVed
或任何其他字母组合也起作用?我是否需要在 Bootstrap 中执行此操作才能获得更好的控制以及如何执行?
routes.test.route = moved
routes.test.defaults.controller = cont
routes.test.defaults.action = move
I'm setting up routes in application.ini, so when I try to access /moved, it displays cont/move. It works but only if I type moved
all lower letters exactly like it's setup on the first line. How can I make Moved
or moVed
or any other letter combination also work? Do I need to do it in Bootstrap to get finer control and how?
routes.test.route = moved
routes.test.defaults.controller = cont
routes.test.defaults.action = move
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这不是一个明智的做法。
URL 区分大小写是有原因的。您将受到搜索引擎的重复内容惩罚。用户也会感到困惑。
但是,您可以创建控制器插件来实现此目的:
This is not a wise approach.
URLs are case sensitive for a reason. You will get duplicate content penalty from search engines. Users will be confused too.
However, you may create controller plugin to achieve this:
我在 Google 上搜索了几分钟,这个页面 (http://joshribakoff.com/?p=29) 涵盖了一个很好的补丁。该补丁覆盖请求对象,而不是调度程序或路由器。
I've searched Google for a few minutes, and this page (http://joshribakoff.com/?p=29) covers a nice patch. This patch overrides the request object, instead of the dispatcher or the router.