views:

52

answers:

1

Hello everyone, I am doing my first Zend Applicaition 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

Please help me out of this problem,because I am totally freaked out thinking of any solution and my mind is also not helping me out.

+2  A: 

Howdy,

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.

ArneRie
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