2016-08-12 87 views
1

我在我的routing.yml文件的簡單redirectt:Symfony2的301重定向不改變URL

products_in_categories: 
    path: /{slug} 
    defaults: { _controller: MpShopBundle:Category:show } 

redirect_category: 
    path: /112-redirect-this 
    defaults: 
     _controller: MpShopBundle:Category:show 
     route: products_in_categories 
     slug: to-this 
     permanent: true 

所以,當我去localhost/web/app_dev.php/112-redirect-this它應該做301重定向並更改網址...它加載頁面成功,但網址沒有改變。它顯示:

localhost/web/app_dev.php/112-redirect-this當它應該顯示: localhost/web/app_dev.php/to-this

難道我做錯了什麼?

+0

[重定向(301)一個從routing.yml中的路由到另一個可能的複製在Symfony2](http://stackoverflow.com/questions/8529038/redirect-301-one-route-to-another-from-routing-yml-in-symfony2) – hchr

回答