protected function _initRoutes()
{
$this->router = $this->frontController->getRouter();
$route = new Zend_Controller_Router_Route(
':username',
array(
'module' => 'default',
'controller' => 'view',
'action' => 'profile',
'username' => ':username'
)
);
$this->router->addRoute('profile', $route);
}
What it's supposed to do is match this:
http://www.mydomain.com/something
To:
http://www.mydomain.com/view/profile/username/something
Which works. The trouble is when I go to:
http://www.mydomain.com
I get a a long database error which is there basically because it is matched to (and it shouldn't be):
http://www.mydomain.com/view/profile
But without a username, which is required.
The route is defined in my bootstrap file. What should I do to make it work right?
EDIT:
It seems the problem is with the url helper in my views. What is wrong with these URLs?
<?php
echo $this->url(array('module' => 'default',
'controller' => 'view',
'action' => 'profile',
'id' => $this->escape($m->id)),
null,
true);
?>
Or:
<?php
echo $this->url(array('module' => 'default',
'controller' => 'my-account',
'action' => 'write-message'),
null,
true);
?>