Routing mechanism in symfony

Written on March 20, 2008 – 5:17 pm | by Sanil S

Symfony Logo

Symfony is one of the coolest framework for web application development in php I have ever used. We can make a blog application in less than an hour, such a simple the framework it is.

Symfony is purely MVC based framework. We can build application very fast using this framework, as a lot of configuration files are there to manage and configure web application properties. Only Symfony developers need to care about this topic. The modules in the symfony application can have different actions. Lets say a module ‘user’ with action ‘login’ carry out the user login of a client session. Then the applications login session’s URL may be something like this http://myapp.com/index.php/user/login. This can’t be simple recognized by search engines. So rewriting those URL to http://myapp.com/login make sense to search engines. Now i am going to discuss how it can be achieved simply by editing a configuration file, routing.yml.

Simply edit routing .yml in ROOT_DIR/apps/application name/config folder.

Add a conf like below

routing

This will routes the request from http://myapp.com/login to http://myapp.com/index.php/user/login. But it is happening only on the application server so the search engines are not aware about this internal routing.

Post to Twitter Tweet This Post Post to Delicious Delicious Post to Digg Digg This Post Post to Facebook Facebook Post to MySpace MySpace Post to Ping.fm Ping This Post Post to Reddit Reddit Post to StumbleUpon Stumble This Post

Posted in » Web1 Comment
Get Adobe Flash playerPlugin by wpburn.com wordpress themes