« Return to Thread: Facebook Vanity URLs

Re: Facebook Vanity URLs

by Nick M :: Rate this Message:

Reply to Author | View in Thread

I used the router route hostname and chained it with a standard router:

routes.user.type = "Zend_Controller_Router_Route_Hostname"
routes.user.route = "www.domain.com"
 
routes.user.chains.following.type = "Zend_Controller_Router_Route"
routes.user.chains.following.route = ":username/following/*"
routes.user.chains.following.defaults.controller = view
routes.user.chains.following.defaults.action = following
 
routes.user.chains.followers.type = "Zend_Controller_Router_Route"
routes.user.chains.followers.route = ":username/followers/*"
routes.user.chains.followers.defaults.controller = view
routes.user.chains.followers.defaults.action = followers
 
routes.user.chains.username.type = "Zend_Controller_Router_Route"
routes.user.chains.username.route = ":username/*"
routes.user.chains.username.defaults.controller = view
routes.user.chains.username.defaults.action = index



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!
>  

 « Return to Thread: Facebook Vanity URLs