Zend 1.10 place websites in virtual subdirectories
Question by Julien
I have the following situation:
We have a webapp built with Zend Framework 1.10 that is available under www.domain.com/webapp
On the server filesystem, we really also have the webapp deployed in /srv/www/webapp
Now, for some reasons I can’t detail too much, the project manager has requested, now that the app is finished, that each client recieves his own url litteraly.
So we would have:
www.domain.com/webapp/client1
www.domain.com/webapp/client2
Normally, what start after the webapp/ would be the controllers, actions and so forth from zend.
Therefore the question: is there a quick way in apache to create these virtual subdirectories, as in the example, client1, client2 ?
I guess it should be possible with url rewriting ?
Thanks in advance
Answer by Starx
Rather than creating virtual directories, this can be solved by creating a specific route with Zend_Route
. Assuming, controller as User
and the action to pass the name would be view
, then
$route = new Zend_Controller_Router_Route(
'webapp/:username',
array(
'controller' => 'user',
'action' => 'view',
'username' => 'defaultuser'
)
);