Reputation: 4084
I am using cakephp 2.0 I need to append the city name before every controller and actions. For example www.sitename.com/users/login needs to change www.sitename/cityname/users/login For Single controller and action i can write a code in routes.php it works.The city name is in session. is there is any way to append city name. I need to generate all the links in the ctp files and while redirecting to other action need to append city name in front www.sitename.com/cityname/controller/action.. Any one have idea please share me
Upvotes: 1
Views: 441
Reputation: 821
Just a head-ups, I don't guarantee it will work out of the box: maybe try to rewrite route in app/Config/routes.php something like
Router::connect('/:city/:controller/:action/', array(), array('city'=>'[a-zA-Z\.\_0-9]+', 'controller'=>'[a-zA-Z\_0-9]+', 'action'=>'[a-zA-Z\_0-9]+'));
It's possible that 'controller' and 'action' part is not necessary.
Upvotes: 1