0

I am doing my first Zend Application and I am finally done with the coding side. But the problem which I have is Client has asked to rewrite the Url's which follows the SEO and as I don't have much knowledge of the Zend Router,I am finding myself helpless this time. Please helo me out.The current Url which I have is...

http://localhost.ZendProject.com/keywords/ball

and Client needs it like

http://localhost.ZendProject.com/ball

and another Url (the search Url)

http://localhost.ZendProject.com/search/trends?q=nishant+shrivastava&select=All&Search=Search

and the Client wants is

http://localhost.ZendProject.com/nishant-shrivastava

Cœur
  • 37,241
  • 25
  • 195
  • 267
Nishant Shrivastava
  • 2,113
  • 3
  • 26
  • 43
  • In your example, can you say which module/controller/action your *current* url requests get routed to, and what request parameters you expect to be set? – Kevin Vaughan Apr 30 '10 at 14:50

1 Answers1

3

i think there is no solution, because the first and second requested url by your client is the same? How can Zend Framework know if you want so show a keyword or search?

For the first route you can add this to your applications.ini (if you use ZF 1.8+):

resources.router.routes.route_1.route = ":keyword"
resources.router.routes.route_1.defaults.module = "default"
resources.router.routes.route_1.defaults.controller = "keywords"
resources.router.routes.route_1.defaults.action = "index"

This will route http://localhost.ZendProject.com/ball to keywords controller / index action and is providing ball als paramater keyword.

opHASnoNAME
  • 20,224
  • 26
  • 98
  • 143
  • You can route those requests to one action, where you can disassemble the URL and choose where to send that request and then use $this->_forward($action, $controller, $module) to do it... :) – Tomáš Fejfar May 01 '10 at 14:55