jblue
jblue

Reputation: 4450

zend routing works only in lowercase letters

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

Upvotes: 1

Views: 251

Answers (2)

takeshin
takeshin

Reputation: 50648

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);
}

Upvotes: 3

Martijn
Martijn

Reputation: 5611

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.

Upvotes: 2

Related Questions