I’m currently working on a website built with symfony 1.4 and I need to implement a route prefix for all the routes. This prefix is used to specify two differents “views” for the website, for exemple :
www.domain.com/b2b : B2B oriented view
www.domain.com/b2c : B2C oriented view
Both of these URLs render the same modules/actions but with little specific differences (textes, images, …). So, http://www.domain.com/b2b/module1/action1 and http://www.domain.com/b2c/module1/action1 must proceed the same action/view but the prefix should be catchable in the action or template.
Is there a way to implement this without having to hard-code the prefix in every urlFor/routeFor call ?
I have found a great ressource page for your needs:
http://particul.es/blog/index.php?post/How-to-change-backend.php-to-admin-prefix-routes-automatically-symfony
With many solutions to achieve your goals. But, personnaly, I think that the smartest way for you is to handle this in .htaccess.