$front = Zend_Controller_Front::getInstance();
$router = $front->getRouter();
$router->removeDefaultRoutes();
$router->addRoute(new Zend_Controller_Router_Route(
':username',
array(
'module' => 'user',
'controller' => 'profile',
'action' => 'view'
)
));
$router->addRoute(new Zend_Controller_Router_Route_Module(
array(), $front->getDispatcher(), $front->getRequest()
));
That's untested, but I believe it should work.
Hope that helps,
-Matt
On Tue, Jun 9, 2009 at 2:59 PM, mapes911
<mapes911@...> wrote:
Hi all,
I've been wondering this for a while now about how Twitter/Myspace and now
Facebook creates what they are calling "Vanity URLs"
So, their users use their username as their url.
ex. www.mydomain.com/myusername would route to their user profile.
So my question is, how can you accomplish this with Zend Framework AND still
have other controller/action pairs as well?
Is there a way to setup a custom route where you check to see if that first
param in the URL is a username, then if not.. attempt to use default
routing?
I have been using default routing completely in the site I am building so I
am very new to the router.
Thanks in advance for your help!
--
View this message in context: http://www.nabble.com/Facebook-Vanity-URLs-tp23952083p23952083.html
Sent from the Zend Framework mailing list archive at Nabble.com.