私のプロジェクトのモジュールには独自のドメインが必要なので、そのためのルートを作成しました:
$portalurl = str_replace( 'http://', '', $config->domains->portal );
$hostnameRoute = new Zend_Controller_Router_Route_Hostname(
$portalurl,
array( 'module' => 'portal' )
);
$defaultroute = new Zend_Controller_Router_Route(
':controller/:action',
array(
'controller' => 'index',
'action' => 'index'
)
);
$contentroute = new Zend_Controller_Router_Route(
'page/:page',
array(
'controller'=> 'content',
'action' => 'show'
)
);
$router->addRoute( 'portalDefault', $hostnameRoute->chain($defaultroute) );
$router->addRoute( 'portalContent', $hostnameRoute->chain($contentroute) );
私のテスト システムでは、アプリケーションは /project/public のようなサブ ディレクトリにあり、システム ホスト リストに入力したドメインを介してモジュールを開くと正常に動作します。domain.lan/project/public. 今、私はシステム (リダイレクト) を介して URL をアセンブルしたいのですが、サブディレクトリなしでそれをアセンブルします。
$this->_redirect(
$this->view->url(array(
'action' => 'index',
'controller' => 'index')
),
array( 'prependBase' => false )
);
はい、私はそれを解決する最も簡単な方法を知っています.vhostを構成することですが、vhostなしで機能し、ルートでパスを手動で設定できる別の解決策が見つからないことが気になります.
これに最適なアプローチは何ですか?