How to create subdomain using username (3.3.15)

  1. How to create a subdomain for each user. Users have the unique username. Like wordpress

  2. How to direct to a user profile.


In my opinion

  1. to root // .httaccess

  2. get subdomain and redirect to // cakephp

    $subdomain = $request->subdomains(1);
    [‘controller’ => ‘usrers’, ‘action’ => ‘view’, $subdomain]

I am not sure it is correct way.