Nishant Shrivastava
Nishant Shrivastava

Reputation: 2119

Implementing the Url Rewriting for a Zend Application

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

Upvotes: 0

Views: 113

Answers (1)

homelessDevOps
homelessDevOps

Reputation: 20726

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.

Upvotes: 3

Related Questions