I got website on Zend Framework (im total noob in Zend). For example I would like to make one URL "somewebsite.com/test/about
" to look like this "somewebsite.com/for-fun-link
". How do i achieve this in Zend ? Im newbie in Zend and Apache server. Where i do rewrites in Zend ? I want static URL somewebsite.com/page/about rewrite to somewebsite.com/about-product
And last question: where do i usually create rewrites ? its depends of sever/technology ?
In your bootstrap, you'll need to configure some "routes". So, if your bootstrap ends something like this:
you can just add in some route definitions like this:
The first parameter of
addRoute()
is just a unique name.Zend_Controller_Router_Route_Static
takes the path you'd like to capture, and then an array of parameters, including a controller and action (and module if it applies).If you wanted to add complexity, you could load the routes out of a database, or start using more dynamic routes. The docs here are a useful next step: http://framework.zend.com/manual/en/zend.controller.router.html#zend.controller.router.routes.standard