1

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

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

2 Comments

ah,sorry I means action ,Thank you for your answer,it works for me,btw is there a way to make multiple actions under index controller and then remove index from the URL with only one router? e.g. www.test.com/index/product to www.test.com/product www.test.com/index/test to www.test.com/test etc...
Can we remove index from controller for all the actions from index controller

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.