2012-03-06 20:20
浏览 46

Zend Framework主机名路由和默认路由

I created a Hostname route like this:

$siteRoute = new Zend_Controller_Router_Route_Hostname(
        'siteSlug' => 'main-site',
        'module' => 'default'

and i chain it with default and other rotues like this:

foreach ($router->getRoutes() as $key => $route) {
    $router->addRoute($key, $siteRoute->chain($route));

The problems are:

When i got to main-site.wordy there is no problem. but if i go to just wordy i get this error message: No route matched the request

And the other problem is when i go to wordy/admin i get this exception: Invalid controller specified (admin)

How can i solve this?

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dph19153 2012-04-29 20:46

    I suggest u to make a htaccess redirect for non www url to 301 redirect on www.wordy in this way u always have :sitename for router hostname !

    RewriteEngine On
    RewriteCond %{SERVER_PORT} ^80$
    RewriteCond %{HTTP_HOST} ^wordy$ [NC]
    RewriteRule ^(.*)$ http://www.wordy/$1 [R=301,L]
    解决 无用
    打赏 举报

相关推荐 更多相似问题