Zend Framework 1 - 隐藏URL中的索引操作

I have these URL's like

www.xyz.com/blog/index
www.xyz.com/tutorial/index

etc - Because I dont want the index to be shown in the URL - I have written routes to fix this issue:

resources.router.routes.blog.route = "/blog/"
resources.router.routes.blog.defaults.controller = blog
resources.router.routes.blog.defaults.action = index

So now when a user types

www.xyz.com/blog - the index action opens up.

What I want is - when a user enters www.xyz.com/blog/index -

it should get redirected to www.xyz.com/blog

Basically the index should not show up in the URL whether or not the user enters it in the URL - How can I achieve this?

Thanks

Assuming you don't actually have a blog controller, I just give you an example code you can add this:

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

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

You could make a separate action just for the redirection and assign it to a URL with /index part

// on /blog/index
public function indexAction()
{
    $this->forward('blog');
}

// on /blog
public function blogAction()
{
    //actual blog action
}

And in the router

<blog type="Zend_Controller_Router_Route">
        <defaults controller="Blog" action="blog" />
        <route>/blog</route>
        <chains>
            <index>
                <defaults action="index" />
                <route>/index</route>
            </index>
            <blog>
                <defaults action="blog" />
                <route>/</route>
            </blog>
        </chains>
</blog>