I am developing an application using zend framework. In the application I have to provide a URL for each user like mydomain.com/[username] then public will be able to view
Create a custom Route (not Router; there is no need to create a custom router!).
Your new route should extend Zend_Controller_Router_Route_Abstract, and override the match method, which takes Zend_Controller_Request_Abstract $request as the first parameter.
In your new match method, simply query your database to see if the custom page, user, etc. exists by comparing against $request->getRequestUri(), and if it does, return the relevant routing information. Example:
return array(
'module' => 'default',
'controller' => 'users',
'action' => 'view',
'user' => $user
);
On failure (can't find the correct user, or page, etc.), then:
return false
This will scale much better than creating a route for every single user, and doesn't require you to mess around with routing too much. It will still work with the standard router, and you can add it to your routes via application.ini as expected.