开发者

zend routing works only in lowercase letters

开发者 https://www.devze.com 2023-02-11 06:09 出处:网络
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 ca

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开发者_如何学运维


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:

public function preDispatch()
{
    $this->getRequest()->setControllerName(
        strtolower($this->getRequest()->getControllerName());
    )->setDispatched(false);
}


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消