user554992
user554992

Reputation:

Zend Framework hierarchical routing

I'm trying to set up routing in the following way using Zend Framework.

I've tried with normal routing but it only got me so far, and it's not working correctly.

resources.router.routes.product.route = ":categoryAlias/:productAlias/*"

resources.router.routes.product.type = "Zend_Controller_Router_Route"

resources.router.routes.product.defaults.controller = index

resources.router.routes.product.defaults.action = catalog

resources.router.routes.category.route = ":categoryAlias/*"

resources.router.routes.category.type = "Zend_Controller_Router_Route"

resources.router.routes.category.defaults.controller = index

resources.router.routes.category.defaults.action = catalog

I can get to:

But that's as far as I've gotten to. Any ideas or tips on how to approach this in a better way?

Upvotes: 0

Views: 699

Answers (1)

Frederik Eychenié
Frederik Eychenié

Reputation: 1253

For the technical part, this similar question will help you.

Now lets talk about some SEO concerns :

What happens if you decide to change the hierarchy for a product ? It's URI would change, and you will have to handle the fact that people will have bookmarked or shared the 'old' url, leading now to a 404. Not to mention page rank implications. You can avoid these issues by still managing the old URL and redirecting to the new url, but that's some work you prefer to avoid from the start.

I would suggest to use short permanent urls, and show the hierarchy in breadcrumbs

  • /product/9384-awesome-printer
  • /category/374-laser-printers

It seems that for google, a page having a short path has more 'importance' than one with a deep path. That's why a lot of sites put what's most important in their eyes with no path at all (my.site.com/awesome-printer), and the rest in short paths. Not to mention that this form is really more readable for humans too.

Also keep in mind that any page should be accessible in maximum 3-5 clicks from the home page, in order to have chances to be indexed by bots. And for humans, it's really annoying too.

Upvotes: 1

Related Questions