Referring to this,
http://symfony.com/doc/current/book/routing.html
we can map url pattern to controller and action
app/config/routing.yml
blog_show:
path: /blog/{slug}
defaults: { _controller: AcmeBlogBundle:Blog:show }
I want to map the path to external url.
app/config/routing.yml
blog_show:
path: /blog/{slug}
defaults: "www.example.com/blog"
The requirement is, my current website is in kohana, I am porting it gradually to symfony 2. For my symfony2 app kohana URL are like external urls, I want to configure these urls in routing and use them in standard way,
e.g. in Twig,
<a href="{{ path('blog_show'}}">
Read this blog post.
</a>
So later on when I port my pages to Symfony, I will have to change only routing file so that I could use same blog_show key to refer to url and I wont' have to change all the files where I have used urls.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…