Bob John
Bob John

Reputation: 13

how to remove index controller only from url in zend framework

In the project I have many controllers,such as Index,Member,Download.

now I want to make the url like www.test.com/index/product to www.test.com/product

but don't want change url www.test.com/member/signup to www.test.com/signup

PS:I added 4 lines in the application.ini

resources.router.routes.default.chains.index.type = "Zend_Controller_Router_Route"
resources.router.routes.default.chains.index.route = ":controller/:action/*"
resources.router.routes.default.chains.index.defaults.controller = "index"
resources.router.routes.default.chains.index.defaults.action = "index"

That has dogged me for many days, hope someone can point out

Upvotes: 1

Views: 824

Answers (1)

bubba
bubba

Reputation: 3847

Assuming you don't actually have a product controller, you can add this:

resources.router.routes.default.chains.index.type = "Zend_Controller_Router_Route"
resources.router.routes.default.chains.index.route = "product/"
resources.router.routes.default.chains.index.defaults.controller = "index"
resources.router.routes.default.chains.index.defaults.action = "product"

and now www.test.com/index/product and www.test.com/product will both work and end up at the same place.

Upvotes: 2

Related Questions