I have a site in Zend Framework. I want to hide one particular controller name in the URL. Explaining the requirement below.
Current URL: http://abcd.com/user/john (which is a profile page of a user)
Preferred URL: http://abcd.com/john
The preferred URL will be displayed in the browser. Also, if a visitor types a username (for eg. http://abcd.com/smith) in the url, the browser will display the user profile.
I have some other controller as well in my site (for eg. http://abcd.com/registration) and don't want to modify or hide those controller name.
I know this can be toodifficult to make a difference to recognise which is the username and which is the controller in the url, but i really want to accomplish this. Please suggest me the needful.
Please note that i am using the below html code to display user profile link.
<a href="<?php echo $site?>user/john">John</a>
Also added the below mentioned router in bootstrap.php file.
$routeUser = new Zend_Controller_Router_Route ('user/:username/',array('controller' => 'User','action'=> 'index'));
$router->addRoute('user', $routeUser);